use re 'debug'; $_ = q{gnl|BL_ORD_ID|3665984}; s/\>.\REPLACE\## for my $ix (1..10){ print "ix($ix)\n"; if( $ix == 3 ){ print "its threeee\n"; next; print "PANCAKES\n"; } print "its not threee\n"; } __END__