M
mixo
I have file name that have a prefix "t-", which
is followed by a number (integer), like
t-1
t-2
t-3
t-10
t-21
and so on.
How can I sort this in numeric order? This avoid a situation
where I get:
t-1
t-10
t-2
t-21
t-3
and so on.
So I far have the following which suffers from the above symptom:
++++++++++++
#!/usr/bin/perl -w
opendir THISDIR, "." or die "serious dainbramage: $!";
@allfiles = readdir THISDIR;
@allfiles = sort @allfiles;
#@allfiles = reverse @allfiles;
closedir THISDIR;
print "@allfiles\n";
++++++++++++
is followed by a number (integer), like
t-1
t-2
t-3
t-10
t-21
and so on.
How can I sort this in numeric order? This avoid a situation
where I get:
t-1
t-10
t-2
t-21
t-3
and so on.
So I far have the following which suffers from the above symptom:
++++++++++++
#!/usr/bin/perl -w
opendir THISDIR, "." or die "serious dainbramage: $!";
@allfiles = readdir THISDIR;
@allfiles = sort @allfiles;
#@allfiles = reverse @allfiles;
closedir THISDIR;
print "@allfiles\n";
++++++++++++