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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2016-06-26 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (328 votes). Check out past polls.