in reply to Where am I going wrong with printing flatfile db records in alphabetical order?

You need to actually call sort if you want something sorted ;-)

You need to sort the whole @list and then loop through to print if that's what you're after. Since you are sorting by the first field anyway, why bother with the 8 character restriction? I'd think that just adding @list = sort @list; before your printing loop should do what you want.

--
I'd like to be able to assign to an luser

Replies are listed 'Best First'.
Re: Re: Where am I going wrong ?
by caciqueman (Novice) on Oct 29, 2001 at 22:31 UTC
    Thanks, this worked:
    @list = sort @list;

      Not to beat a dead horse too much, but is there any reason not to simply sort the list as it's read (which conserves memory, if THAT matters here)? To wit:

      open DATABASE, $mydata or die "Can't open $mydata: $!\n"; flock DATABASE, LOCK_EX or die "Can't lock $mydata: $!\n"; my @list = sort <DATABASE>; # NOTE ^^^^ close DATABASE; # which also unlocks it

      dmm

      
      You can give a man a fish and feed him for a day ...
      Or, you can teach him to fish and feed him for a lifetime