in reply to File problems

Why don't you read the directory entries with internal Perl functions, instead of relying on some external program (OLDTTGW principle):
Fill_List( '/dir', '^error' ); sub Fill_List { my $dir = shift; my $match = shift; my @found; opendir DIR, $dir or die "Cannot open directory $dir: $!"\n; while( defined( my $file = readdir(DIR) )) { push @found, $file if $file =~ /$match/o; } close DIR; return @found; }

Note that I am returning the values in an array. It is better to have a routine do one thing, and one thing only. If you want to write the contents out to a file, do that in another routine. Prepare for (obvious) future uses the code could be put to.

Your code has a few style issues that leap out at me:

update: oops, re-reading my code makes me realise this code will only work correctly the first time it is called, due to the /o modifier on the regexp. (It will just keep on returning files that match what the first call was asked to match. The correct method would be to use the qr// operator if the version of Perl supports that. Just put $match = qr/$match/; before the while loop. Otherwise, for earlier versions, one would have to build the loop up in a string, and eval that, which is downright icky.

--
g r i n d e r
just another bofh

print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u';