in reply to •Re: One liner to Check and undef hash elements
in thread One liner to Check and undef hash elements
Doh, I knew there was a single step approach for Nr.2.. it just wouldn't occur to me last night.
I'm not sure I like your approach to the first one though - using a subref to get around the lack of control in naked blocks seems to hackish. I'm not really happy with my own alternative, either:
But without Perl 6 junctions there's not much that can be done about it if you need shortcircuiting..my $hash_has_non_undef = do { local $_; my $found = 0; defined && ($found++, last) while (undef, $_) = each %hash; $found; };
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re^2: One liner to Check and undef hash elements (shortcircuiting)
by merlyn (Sage) on Apr 16, 2003 at 11:46 UTC | |
by Aristotle (Chancellor) on Apr 16, 2003 at 11:53 UTC |