Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Parsing CSV only returns the second line of the file

by Anonymous Monk
on Sep 01, 2012 at 06:48 UTC ( #991123=note: print w/replies, xml ) Need Help??

in reply to Parsing CSV only returns the second line of the file

Anyone knows where I'm doing something wrong?

One loop inside another, without adequate understanding of files and modulus operator

$ perl -le " for(1..20){printf qq{%s %s\n}, $_, int($_ % 1 ); } " 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0

Replies are listed 'Best First'.
Re^2: Parsing CSV only returns the second line of the file
by saint_geser (Initiate) on Sep 01, 2012 at 07:00 UTC

    Could you please elaborate on that. I don't know much about perl, you're right but it is really annoying to do all these files by hand.

      Could you please elaborate on that.

      Find places in your code, say, a loop inside a loop, where you use the modulus operator, say like "% 1"

      Then compare that line to my code, esp the output

      When do you think that inner loop will end?

      Here is a better one, what do you think the inner while loop does, what is its purpose?

      Here is another hint, how many times do you get this warning (after you add the code)?  if( warn "calling parse " and $csv->parse($_) ) {

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991123]
[TCLion]: Good Morning Monks, I am parsing logs and some date time formats are inconsistent. I am trying to make output all same format. What is the best way to convert a month(word) to month(number)?
[Corion]: TCLion: I'm not aware of a better way than manually building the hash, as all strptime incarnations I know have nasty edge cases

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (15)
As of 2017-03-23 14:38 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (287 votes). Check out past polls.