valavanp has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl use strict; use warnings; %h=('1', 'one', '2', 'two', '3', 'three'); @arr=(1,2); foreach $key(keys %h) { push(@arr,$h{$key}); } print @arr; @arr=(3,4,5); foreach $key(keys %h) { push(@arr,$$h{$key}); print "@arr\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pushing hash values to an array
by davorg (Chancellor) on Oct 16, 2006 at 11:24 UTC | |
|
Re: pushing hash values to an array
by blazar (Canon) on Oct 16, 2006 at 11:51 UTC | |
by valavanp (Curate) on Oct 16, 2006 at 12:13 UTC | |
by blazar (Canon) on Oct 16, 2006 at 13:40 UTC | |
by wfsp (Abbot) on Oct 16, 2006 at 12:21 UTC | |
|
Re: pushing hash values to an array
by Hofmator (Curate) on Oct 16, 2006 at 11:18 UTC | |
|
Re: pushing hash values to an array
by Anonymous Monk on Oct 16, 2006 at 11:38 UTC | |
|
Re: pushing hash values to an array
by fenLisesi (Priest) on Oct 16, 2006 at 12:35 UTC | |
|
Re: pushing hash values to an array
by jwkrahn (Abbot) on Oct 16, 2006 at 15:22 UTC |