in reply to Strange grep and matching behaviour...

How about this:
sysopen (FILE,$filename,O_RDONLY) or die "Error! $!\n"; my (@slurp) = grep !/fubar/,<FILE>; close FILE;
Let the almighty grep take care of filtering all lines containing 'foobar' out. The match should do it just fine.

I tested similar script with this command:
echo 'fubar\nfoo' | perl -e '@stuff=grep \!/fubar/, <STDIN>;print@stuf +f;'
This would only print:
foo
and filter the 'foobar' line out! ;-)

UPDATE: owww, and how did I miss so many earlier posts!? I'm sorry Ovid, I didn't notice your post which makes my look like nothing but straight copy. ;/.

_____________________
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/;$_=&#91"ps -e -o pid | "," $2 | "," -v "," "&#93;`@$_`?{print" ++ $1"}:{print"- $1"}&&`rm $1`;print"\n";}