Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Perl Array issue.

by tobyink (Abbot)
on May 07, 2012 at 07:19 UTC ( #969198=note: print w/ replies, xml ) Need Help??


in reply to Perl Array issue.

You never increment $done (or at least you don't in the incomplete code shown above). Therefore $done is always zero, and while($done==0) will keep looping.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re: Perl Array issue.
Select or Download Code
Re^2: Perl Array issue.
by Pan20 (Novice) on May 07, 2012 at 15:34 UTC

    Hi tobyink , how can I increment $done ? don't you think that my @timestamp array is causing the infinite loop,because without this piece of code it works, how can I make the array stop at the end of the string, Thanks.

      ++ is the increment operator. You can also use = to assign a nonzero value if you like.

      Let's back up a step: what's the purpose of your inner while loop? Is there a reason you might want to insert some records from your input file multiple times? If not, then you don't need that while loop (or $done or $retry). Just loop through your CSV file record by record as you're doing, and for each record, do whatever processing you need to do on the fields and insert it into your database.

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2014-07-28 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (194 votes), past polls