There being more than one way to do it:
use strict; use warnings; my $search_date = shift; my $Line; while ($Line = <DATA>) { next if !(($_) = $Line =~ /^\d{6}.{46}(.{10})/g and $search_date eq +$_); print $Line; print <DATA>; last; } __DATA__ 000001 various stuff on the line before the date 02/25/2005 000002 various stuff on the line before the date 03/10/2005 000003 various stuff on the line before the date 04/15/2005 000004 various stuff on the line before the date 05/21/2005
In reply to Re: Looping through end of file once a match is found
by GrandFather
in thread Looping through end of file once a match is found
by MBolton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |