my $line = 'fee fi fo fum'; my $pat = qr/i smell the blood/; unless( grep /$pat/, $line ){ print "of an englishman\n"; } __END__
Prints "of an englishman", because $line doesn't match $pat
That condition is more commonly written as one of these
unless( $line =~ /$pat/ ) { ... if( not $line =~ /$pat/ ) { ... if( $line !~ /$pat/ ) { ...
In reply to Re: unless condition not working
by Anonymous Monk
in thread unless condition not working
by perlavi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |