if(my $cnt = /^ policy-map $ouputpol/ ... / policy-map/) { #### print unless $cnt==1 || $cnt =~ /E/; #### if(($my $first = /^ policy-map $ouputpol/) ... (my $last = / policy-map/)) { #### print unless $first || $last; #### for my $i (1 .. 15) { if(my $cnt = $i==5 ... $i==10) { print "$i - $cnt\n"; } } #### for my $i (1 .. 15) { if((my $first = $i==5) ... (my $last = $i==10)) { # note: $first will be undefined for any but the first line because of the 3 dots # and $last will be undefined for the first line local $^W; print "$i - $first / $last\n"; } }