Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Array iteration: foreach works, for doesn't

by Bloodnok (Vicar)
on Nov 23, 2009 at 13:33 UTC ( #808810=note: print w/replies, xml ) Need Help??


in reply to Array iteration: foreach works, for doesn't

In the foreach loop, the $_ variable is set implicitly, so the pattern match within parse_datetime() will always 'work' whereas ... in your for loop, the $_ variable remains unset, so the match always fails.

Try (local $_ = shift) =~ ... or +shift =~ .... in place of $_ =~ at the start of parse_datetime()

A user level that continues to overstate my experience :-))

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://808810]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2016-12-06 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (96 votes). Check out past polls.