Hagbone has asked for the wisdom of the Perl Monks concerning the following question:
Vs.foreach (@whatever) { if (/^does this match$/) { do something; } }
Assuming I'm thinking correctly so far, my next question has to do with creating the hash value. Is there anything "wrong" with populating a hash with keys and values that are the same? For example:if (/$hash{$whatever}/) { do something; }
It feels like there's something wrong (or maybe more accurately, inefficient) using a hash this way, but I'm not smart enough to know if that is in fact true.%SampleHash ( 'whatever' => 'whatever', 'whoever' => 'whoever', )
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating lists using a hash with the same key/values
by Trimbach (Curate) on Jan 01, 2003 at 23:53 UTC | |
|
Re: Creating lists using a hash with the same key/values
by tachyon (Chancellor) on Jan 01, 2003 at 23:55 UTC | |
|
Re: Creating lists using a hash with the same key/values
by atcroft (Abbot) on Jan 01, 2003 at 23:52 UTC | |
|
Re: Creating lists using a hash with the same key/values
by djantzen (Priest) on Jan 02, 2003 at 00:01 UTC | |
|
Re: Creating lists using a hash with the same key/values
by bart (Canon) on Jan 02, 2003 at 09:02 UTC | |
|
Re: Creating lists using a hash with the same key/values
by gjb (Vicar) on Jan 02, 2003 at 00:22 UTC |