Re: Extracting values from hash keys
Dave Chappell wrote: > > Hi, Hello, > I have a hash that will have some keys contain single values and other keys > that will have multiple values: > > %hash = ( > key1 => 'test-1', > key2 => ['test-2-0', 'test-2-1'], > key3 => 'test-3' > ); The simple answer is to put all values
RE: Extracting values from hash keys
Use the ref function.. foreach $key(keys %hash) { if(ref($hash{$key})){ print "$key = array( "; foreach my $item (@{$hash{$key}}){ print "$item "; ) print ")\n";