David Aldridge
asked on
Sorting an array
I have the following code:
@strSortedList = sort (@strList);
for($k = 0, $k <= $#strSortedList; $k==)
{
print "$strSortedList[$k]\n";
}
The list is sorted, however, The Uppercase are sorted first, then the lower case, like so:
Afirstfile
Athirdfile
absecondfile
Blah
Bmblahtoo
betc
I would like to sort it, ignoring the case... how can I do this?
Thanks gurus!
holein5
@strSortedList = sort (@strList);
for($k = 0, $k <= $#strSortedList; $k==)
{
print "$strSortedList[$k]\n";
}
The list is sorted, however, The Uppercase are sorted first, then the lower case, like so:
Afirstfile
Athirdfile
absecondfile
Blah
Bmblahtoo
betc
I would like to sort it, ignoring the case... how can I do this?
Thanks gurus!
holein5
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
for($k = 0, $k <= $#strSortedList; $k++)
{
print "$strSortedList[$k]\n";
}
can also be written
print "$_\n" for @strSortedList;
{
print "$strSortedList[$k]\n";
}
can also be written
print "$_\n" for @strSortedList;
for($k = 0; $k <= $#strSortedList; $k++)
{
print "$strSortedList[$k]\n";
}
can also be written
print "$_\n" for @strSortedList;
{
print "$strSortedList[$k]\n";
}
can also be written
print "$_\n" for @strSortedList;
ASKER
Hey, that's pretty cool.. thanks
ASKER
Thanks,
holein5