in reply to Sorting Question
If you want it to basically do what it's doing, but return the output in sorted order, this should work.
Otherwise, you'll have to be a bit clearer about what you're expecting. I made a few incidental changes, reading the file in one line at a time instead of all at once, etc, but they're just for style. The heart of it is, instead of outputting one at a time, push them into an array you can sort and output. If that's what you want to do.my $editlist = $FORM{'list'}; open(FILE, "$datadir/$editlist.txt") or error_message("Can't find data file - $datadir/$editlist.txt."); my $ccc = 0; my @out; while (<FILE>){ my ($two, $one, $nochop) = split(/,/); if ($one =~ /.*\@.*\..*/) { push @out, "$two,$one\n"; $ccc++; } } close(FILE); print sort @out;
|
|---|