in reply to totally lost

Another way to write it:

unless ($input =~ /badinput/) { print $input; }

Or even

print $input unless $input =~ /badinput/;

With perl 5.10 or newer you can also write

use 5.010; given ($input) { print unless /badinput/; }

Though usually it is a better idea to check for valid input (whitelisting) than checking for bad input (blacklisting).

Replies are listed 'Best First'.
Re^2: totally lost
by Jenda (Abbot) on Apr 29, 2012 at 18:44 UTC

    You do not need given, for/foreach is enough and works even in ancient perls.

    for ($input) { print unless /badinput/; }

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.