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

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