#!perl eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; # this emulates #! processing on NIH machines. # (remove #! line above if indigestible) eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift; # process any FOO=bar switches while (<>) { @Fld = split(' ', $_, -1); $tm = $Fld[(1)-1] . ' ' . $Fld[(2)-1] . ' ' . $Fld[(3)-1]; ; print $_ if $start lt $tm && $tm lt $end; #??? #??? } Please check my work on the 2 lines I've marked with "#???". The operation I've selected may be wrong for the operand types. #### #!/usr/bin/perl -- use strict; use warnings; use Data::Dump; my $start = qx{date +'%b %e %T'}; my $end = qx{date -d '10 mins ago' +'%b %e %T'}; dd $start, $end; while (<>) { my @Fld = split(' ', $_, -1); my $tm = $Fld[(1)-1] . ' ' . $Fld[(2)-1] . ' ' . $Fld[(3)-1]; print $_ if $start lt $tm and $tm lt $end; }