/(\w{3}\s+\w{3}\s+\d{1,2}/; my $date = $1; #### #!/usr/bin/perl -w use strict; # stuff # (in while loop) while () { next unless my ($date) =~ /(\w{3}\s+\w{3}\s+\d{1,2})/; # stuff if ($foo) { print "Date is $date\n"; } # more stuff }