$test =~ /^foo /; $test =~ / bar$/; #### @compare = "/^foo /", "/ bar$/"; $i=0 foreach (@compare){ unless $test =~ @compare[$i]){ print $test; $i++ }