Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: store multiple files in multidimensional array

by repellent (Priest)
on Mar 19, 2012 at 02:06 UTC ( #960354=note: print w/replies, xml ) Need Help??

in reply to store multiple files in multidimensional array

If you're globbing as in @filesList = <*> or @filesList = glob "*", consider what the order of the files would be in the array. You may want it sorted:
bash-3.2$ cat d1 abc cde edf bash-3.2$ cat d2 rst tuv uvw bash-3.2$ cat d3 ghi hij jkl bash-3.2$ cat my %data; while (<>) { chomp; push @{ $data{$ARGV} }, $_; } my @sorted_data = map $data{$_}, sort keys %data; use Data::Dumper; warn Dumper \@sorted_data; bash-3.2$ * $VAR1 = [ [ 'abc', 'cde', 'edf' ], [ 'rst', 'tuv', 'uvw' ], [ 'ghi', 'hij', 'jkl' ] ];

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://960354]
[Eily]: Hi monks o/
[choroba]: 3 PM in Vietnam, BTW
Discipulus maybe a wrong impression..
[karlgoethebier]: Discipulus: Workshops are for weenies ;-)
[Discipulus]: here 43C high umidity, tiger mosquitos, violence in the street.. everywhere is vietnam
[karlgoethebier]: OK, i'm socially unacceptable
[karlgoethebier]: Discipulus: Were the hell are you today?
[Discipulus]: ..or suitable for the presidence ;=)
[Discipulus]: at Caput Mundi

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2017-06-27 08:14 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (600 votes). Check out past polls.