On Aug 18, 1:03 pm, [EMAIL PROTECTED] (Anjan Purkayastha)
wrote:
> hi,
> i'm struggling with a hash of arrays problem.
> suppose i create the following HOA:
> $HOA{$key}= [qw(a,b,c,d)];

I doubt that the results of that assignment is what you want/expect.

#!/usr/bin/perl

#use strict;
use warnings;
use Data::Dumper;

$key = 'key';
$HOA{$key}= [qw(a,b,c,d)];
print Dumper \%HOA;

outputs:
Possible attempt to separate words with commas at C:\test\perl-2.pl
line 8.
Possible attempt to separate words with commas at C:\test\perl-2.pl
line 8.
Possible attempt to separate words with commas at C:\test\perl-2.pl
line 8.
$VAR1 = {
          'key' => [
                     'a,b,c,d'
                   ]
        };

I suspect you wanted this:
$HOA{$key}= [qw(a b c d)];

which will give you:
$VAR1 = {
          'key' => [
                     'a',
                     'b',
                     'c',
                     'd'
                   ]
        };


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to