Link to home
Start Free TrialLog in
Avatar of David Aldridge
David AldridgeFlag for United States of America

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

ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David Aldridge

ASKER

That did it!

Thanks,
holein5
for($k = 0, $k <= $#strSortedList; $k++)
    {
      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;
Hey, that's pretty cool.. thanks