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

Re: Bulk Reading and Writing of Large Text Files

by Tux (Abbot)
on May 23, 2013 at 06:33 UTC ( #1034880=note: print w/replies, xml ) Need Help??

in reply to Bulk Reading and Writing of Large Text Files

This looks like (malformed: spaces) CSV data to me. Splitting the lines, however simple it may look right now, seldom is the correct way to deal with that kind of data. Use Text::CSV_XS or Text::CSV:

use Text::CSV_XS; my $csv = Text::CSV_XS->new ({ binary => 1, allow_whitespace => 1, aut +o_diag => 1 }); my $fs = -s $ARGV[0] or die "Empty input file"; open my $fh, "<", $ARGV[0]; while (my $row = $csv->getline ($fh)) { print int (100 * tell ($fh) / $fs), "%%\r"; my $sstation = $row->[5]; ...

Enjoy, Have FUN! H.Merijn

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2016-10-22 13:58 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (294 votes). Check out past polls.