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 (){ my ($two, $one, $nochop) = split(/,/); if ($one =~ /.*\@.*\..*/) { push @out, "$two,$one\n"; $ccc++; } } close(FILE); print sort @out;