my $logpath = "\\\\directory\\log\\"; my $logfile = "logfilename_20061201_LOG"; my $date = "20061201"; my $log = "$logpath$logfile"; open LOG, "<", $log or die "Cannot open $log for read :$!"; while () { if ($log =~ /$dateregex/) { etc...