Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Perl Riddle

by webfiend (Vicar)
on Dec 03, 2007 at 22:08 UTC ( #654664=note: print w/replies, xml ) Need Help??

in reply to Perl Riddle

It might just be a personal problem, but most times I use each it ends up biting me. I've just settled into using a for loop, and it never caused me any problems related to resetting.

So instead of

while( my ($k, $v) = each(%ENGINES)){ push @eng, $v->{'name'}; }

... I would probably end up doing this:

for my $k (keys %ENGINES) { my $v = $ENGINES{$k}; push @eng, $v->{'name'}; }

This is a personal preference, and I'll admit that it does result in a little more code. I'm okay with that. I'd probably use map if I was concerned about brevity. The important thing is that I don't have to worry about resetting anything.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://654664]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2019-07-24 07:25 GMT
Find Nodes?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?

    Results (32 votes). Check out past polls.