Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: Error when running on larger files

by K_Edw (Beadle)
on Jun 28, 2016 at 09:40 UTC ( [id://1166741]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Error when running on larger files
in thread Error when running on larger files

I wonder if it is indeed a subtle error with the input file then - although that would be quite odd as every line in it was printed by Perl in the exact same manner. I've uploaded my failing file here:

https://www.dropbox.com/s/mofwaf7iiuif0ur/Example.txt.zip?dl=0

Let me know if that is not suitable/inaccessible. Should be able to download without logging in.

Replies are listed 'Best First'.
Re^5: Error when running on larger files
by BrowserUk (Patriarch) on Jun 28, 2016 at 09:58 UTC

    Hm. Other than having to add a line to discard the header; your file processed to completion without error.

    Two possibilities:

    1. (Unlikely) The data file is corrupted on disk with a bad block or similar.

      Copy the file to another name (or unzip the zip you posted) and try that.

    2. (More unlikely). Your perl installation is broken.

      Install another version and try again.

    Beyond those we're into a world of even more speculative guessing.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.

      I tried also to run the code on the file. It's run perfectly on my system after throwing away the header.

      I still suspect you have somewhere unexpected characters in your input. The errors point to that. This can be invisible characters that aren't visible and can't be automatically transformed by Perl to a number. Try to validate your input by something like this:

      unless ($F2[2] =~ /^[+-]?\d+\.?\d*$/) {print "not an floating number\n +";} #assumes "." as digital separator, no thousand separator unless ($F3[2] =~ /^[+-]?\d+\.?\d*$/) {print "not an floating number\n +";}

      Look also to http://www.perlmonks.org/?node_id=622704 for a more in detail explanation. It is possible that later versions of Perl are more robust in transforming a string to a number.

      Martell

      How bizarre. I've tried running it on 5.25.2 and 5.24.0 installed via Perlbrew. Same error each time.

      It seems to be caused by something earlier in the script (this chunk of code forms a subsection of it) - running my file using your wrapped code allows it to run to completion.

      Why exactly it fails near the end of a file when it's part of a larger script but not when it's separate is beyond me.

        It seems to be caused by something earlier in the script

        Does the earlier code read the same file? Does the earlier code use much memory?

        Perhaps you should post the entire script.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
        In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-29 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found