"George" <> wrote in news

n0e6ysfg39enkw002
@news.europe.nokia.com:
> Josef Moellers wrote:
>
>> George wrote:
>> > Alextophi wrote:
>> >
>> >
>> > > FR ----------------------------------------------
>> > > Bonjour
>> > >
>> > > Comment faire un tableau avec 1 'clé' avec 2 valeurs.
>> > >
>> > > ex: {clé} = (valueA, valueB)
>> > >
>> > >
>> > > EN ----------------------------------------------
>> > > Hello
>> > >
>> > > How to make a table with 1 'key' with 2 values.
>> > >
>> > > ex : {key} = (valueA, valueB)
>> > >
>> > >
>> > > regard
>> > >
>> > > ch.
>> >
>> >
>> > @{$key}=("value1","value2")
>>
>> use warnings; use strict;
>> @{$key}=("value1","value2")
>>
>> Global symbol "$key" requires explicit package name at - line 2.
>> Execution of - aborted due to compilation errors.
>
> should I also tell him to install perl,dumb head
No, but you should realize you are in no position to hurl insults at
people, let alone give advice.
I presume you meant to use a hash slice above. But even with a hash
slice, you get the following:
#!/usr/bin/perl
use strict;
use warnings;
my %hash;
@hash{key} = ('value1', 'value2');
use Data:

umper;
print Dumper \%hash;
__END__
D:\Home\asu1\UseNet\clpmisc> z
Scalar value @hash{key} better written as $hash{key} at D:\Home\asu1
\UseNet\clpmisc\z.pl line 7.
$VAR1 = {
'key' => 'value1'
};
To have a hash element refer to more than one element, you need to set
$hash{key} to an array reference:
$hash{key} = ['value1', 'value2'];
Oh, by the way *PLONK*
Sinan
--
A. Sinan Unur <>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html