Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Two dimension array from text file

by thezip (Vicar)
on Jul 11, 2008 at 16:44 UTC ( #697016=note: print w/replies, xml ) Need Help??


in reply to Two dimension array from text file

Try this to see if it's what you need:

use strict; use warnings; use Data::Dumper; my @array = (); while (my $line = <$ifh>) { push(@array, [ (split(/\t/, $line))[0,3,7] ]); } print Dumper(\@array);

Update: BTW, in your spec, you say the 1st, 4th, and 8th column, but in your output data you show the 1st, 3rd and 8th columns. Which is it?

Update: I see that you have updated your root node to reflect the corrected indices. Generally, it is considered to be polite to indicate (via an Update: such as this) that you have changed the wording/context of your node. Otherwise, it makes the respondents look like *they* made the mistake.


Your wish is my commandline.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://697016]
help
Chatterbox?
[1nickt]: The Google-fu is strong with this one.
[1nickt]: I was looking at Best Buy since like the in-store return/repace plan ... but the 17" HP Envy they have is not this one ....
[1nickt]: May be brand new ... 0 reviews on the site.

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2017-03-26 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (315 votes). Check out past polls.