$line!~ m/foo/ Your code will enter an infinite loop when the condition is true, though. Better alternatives:
(assuming $line has been assigned somewhere else)
unless ($line =~ m/foo/) {
print $line;
}
or
(assuming lines are read in from stdin)
while ($line = <>) {
unless ($line =~ m/foo/) {
print $line;
}
}
(sorry, board ate spaces somehow)