use strict; use warnings; my $search_date = shift; my $Line; while ($Line = ) { next if !(($_) = $Line =~ /^\d{6}.{46}(.{10})/g and $search_date eq $_); print $Line; print ; 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