use strict; use warnings; my $A = "abc\ndef\nghi\n"; while ($A =~ /(.+)/g) { print "$1\n" unless $1 =~ /def/; } #### 13:59 >perl 1419_SoPW.pl abc ghi 14:00 >