in reply to Loop once on condition 1, many times on cond. 2?
foreach $key ( ($x eq 'key_1') ? keys %my_hash : $x ) { do a bunch of stuff }
UPDATE: Had to reverse the logic of the ?:, thought you wanted it the other way round
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Loop once on condition 1, many times on cond. 2?
by punch_card_don (Curate) on Oct 09, 2008 at 15:23 UTC | |
by ikegami (Patriarch) on Oct 09, 2008 at 15:32 UTC | |
by jethro (Monsignor) on Oct 09, 2008 at 15:33 UTC | |
by punch_card_don (Curate) on Oct 09, 2008 at 15:37 UTC | |
by AnomalousMonk (Archbishop) on Oct 09, 2008 at 18:19 UTC | |
by gone2015 (Deacon) on Oct 09, 2008 at 16:57 UTC |