use strict; use warnings; #### my $file = 'C:/Work/PAYROLL>TXT'; open(my $fh, '<', $file) or die "Cannot open file '$file' for reading: $!"; #### #! perl use strict; use warnings; my $start_day = '1/17'; while (my $payperiod = ) { if ($payperiod =~ /$start_day/ .. 0) { print $., ' '. $payperiod; } } __DATA__ start: 1/3 aaa end: 1/16 start: 1/17 bbb end: 1/30 start: 1/31 ccc end: 2/13 #### 1:26 >perl 1110_SoPW.pl 4 start: 1/17 5 bbb 6 end: 1/30 7 start: 1/31 8 ccc 9 end: 2/13 1:26 >