P
Patrick Viet
Hello,
I've been using a weird syntax to assign elements from a hash to array
for several years now. Doesn't work in 5.10. I saw the changelog and it
said pseudo-hashes didn't exist. Didn't know it was pseudo hash I was
using... Anybody knows how to adapt my code ?
Here it is :
$h = {
a => 'data1',
b => 'data2',
c => 'data3',
...
};
my ($data_a,$data_b) = @{$h}{'a','b'};
Any other idea to do this ? Obviously an alternative syntax would be :
my $data_a = $h->{'a'};
my $data_b = $h->{'b'};
But this kind of sucks because my real usage is like this :
(in sql req)
while(my $href = $sth->fetchrow_hashref) {
my $key = join('|',@{$href}{@cols_primary});
Which is really practical ...
Any ideas ?
Thanks,
I've been using a weird syntax to assign elements from a hash to array
for several years now. Doesn't work in 5.10. I saw the changelog and it
said pseudo-hashes didn't exist. Didn't know it was pseudo hash I was
using... Anybody knows how to adapt my code ?
Here it is :
$h = {
a => 'data1',
b => 'data2',
c => 'data3',
...
};
my ($data_a,$data_b) = @{$h}{'a','b'};
Any other idea to do this ? Obviously an alternative syntax would be :
my $data_a = $h->{'a'};
my $data_b = $h->{'b'};
But this kind of sucks because my real usage is like this :
(in sql req)
while(my $href = $sth->fetchrow_hashref) {
my $key = join('|',@{$href}{@cols_primary});
Which is really practical ...
Any ideas ?
Thanks,