P
Patrick
Hi people,
I'm looking for info I just can't figure out through the manual.
Here is the doc :
http://perldoc.perl.org/perldata.html#Slices-slice-array,-slice-hash,-slice
I understand it says that if
%hash = ( key1, 'value1', key2, 'value2 };
then you can simply assign
($scalar1,$scalar2) = @hash{key1,key2};
Easy, simple, convenient.
Now I try to do it with a hashref.
$hashref = { key1 => 'value1', key2 => 'value2' };
One would imagine that would work:
($scalar1,$scalar2) = $hashref->{key1,$key2};
or lets say :
($scalar1,$scalar2) = @hashref->{key1,$key2};
I even tried :
($scalar1,$scalar2) = @{$hashref->{key1,$key2}};
Still doesn't work.
Anyone has ideas ?
Thanks very much.
Patrick
I'm looking for info I just can't figure out through the manual.
Here is the doc :
http://perldoc.perl.org/perldata.html#Slices-slice-array,-slice-hash,-slice
I understand it says that if
%hash = ( key1, 'value1', key2, 'value2 };
then you can simply assign
($scalar1,$scalar2) = @hash{key1,key2};
Easy, simple, convenient.
Now I try to do it with a hashref.
$hashref = { key1 => 'value1', key2 => 'value2' };
One would imagine that would work:
($scalar1,$scalar2) = $hashref->{key1,$key2};
or lets say :
($scalar1,$scalar2) = @hashref->{key1,$key2};
I even tried :
($scalar1,$scalar2) = @{$hashref->{key1,$key2}};
Still doesn't work.
Anyone has ideas ?
Thanks very much.
Patrick