adrive has asked for the wisdom of the Perl Monks concerning the following question:
unlike php, where i could actually do this :my @item; my $val; $item["A"] = (["dunno", "i think so"]); $item["B"] = (["okay", "duh"]); foreach $val(@item){ #$val holds array A and B's 0 position, but no other parameters to get its key name instead. }
anyway to do this..without asking me to change it to hashes?foreach($item as $key=>$value) { //where $key is keyname, and $value is the value }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to get array's key name?
by Corion (Patriarch) on Feb 22, 2008 at 08:55 UTC | |
|
Re: how to get array's key name?
by wfsp (Abbot) on Feb 22, 2008 at 11:31 UTC | |
|
Re: how to get array's key name?
by adrive (Scribe) on Feb 22, 2008 at 09:07 UTC | |
by stiller (Friar) on Feb 22, 2008 at 09:31 UTC |