Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Splitting Multiple files into arrays.

by devbond (Novice)
on Jul 21, 2013 at 11:07 UTC ( #1045502=note: print w/ replies, xml ) Need Help??


in reply to Re: Splitting Multiple files into arrays.
in thread Splitting Multiple files into arrays.

I have a 2D File like the following and i have 8 such files which i have to put into 8 Arrays. 00:00 2453 10319 0 0 01:00 1565 626 0 0 02:00 1171 4195 0 0 03:00 1117 3597 4 0 04:00 1494 569 0 0 05:00 2873 0900 0 0 06:00 4899 2368 0 0 07:00 4251 9664 0 0 08:00 5791 8910 0 0 09:00 7068 0138 0 0 10:00 8464 3881 0 0 11:00 9610 5291 0 0 12:00 1017 8634 0 0 13:00 1090 8203 0 0 14:00 1322 9165 0 0


Comment on Re^2: Splitting Multiple files into arrays.
Re^3: Splitting Multiple files into arrays.
by rjt (Deacon) on Jul 21, 2013 at 20:47 UTC

    That data is tab-delimited, not space-delimited. I'd use Text::CSV for this.

    use Text::CSV; my $csv = Text::CSV->new({ sep_char = "\t" }); my $array_ref = $csv->getline_all($fh); # OR... my @array = @{ $csv->getline_all($fh) };

    You can easily adapt the loop constructs I suggested, above, or many of the other suggestions given by others, with this approach. Good luck.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2015-07-04 15:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls