Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Perl Riddle

by webfiend (Vicar)
on Dec 03, 2007 at 22:08 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-03-29 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found