Hi all,
I have several directories (~100) that I need to sort and throw into a select box. That I can do except the sort.
The dirs are named the same, except for a number at the end.
Example A1 A2 A3 ... A100
So, you know how the sort works, and I get A1 A10 A100 A2 A20 etc.
How do I get this into a more 'normal' orser so I get A1 A2 A3 ... A100
The code I am working with is:
Thanks for any help,
Jim
I have several directories (~100) that I need to sort and throw into a select box. That I can do except the sort.
The dirs are named the same, except for a number at the end.
Example A1 A2 A3 ... A100
So, you know how the sort works, and I get A1 A10 A100 A2 A20 etc.
How do I get this into a more 'normal' orser so I get A1 A2 A3 ... A100
The code I am working with is:
Code:
@dir = sort {$a<=>$b} (@alf);
foreach $item (@alf)
{
if (-d "$tree$item" &&!(-l "$tree$item"))
{
next if ($item =~ m/^\.+$/);
push @dir, $item;
}
}
print "Directories: @dir\n";
Thanks for any help,
Jim