in reply to Re^3: Hashes and String Variables
in thread Arrays and Strings in Hashes
Can you tell me what I am doing wrong here?
use warnings; use strict; my @files = qw( http://use.perl.org/ http://search.cpan.org/ http://jobs.perl.org/ ); my %hash = ( curArray => [], prevArray => [], ); foreach my $url2 ( @files ) { push @{ $hash{url} }, $url2; } use Data::Dumper; print Dumper(\%hash); __END__ $VAR1 = { 'prevArray' => [], 'curArray' => [], 'url' => [ 'http://use.perl.org/', 'http://search.cpan.org/', 'http://jobs.perl.org/' ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Hashes and String Variables
by mr_p (Scribe) on Jun 14, 2010 at 14:01 UTC |