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 t4.pl
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$ t4.pl *
$VAR1 = [
[
'abc',
'cde',
'edf'
],
[
'rst',
'tuv',
'uvw'
],
[
'ghi',
'hij',
'jkl'
]
];
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|