Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Perl-Sensitive Sunglasses
 
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 :-))


Comment on Re: Array iteration: foreach works, for doesn't
Select or Download Code

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 chanting in the Monastery: (5)
As of 2014-04-20 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls