#!/usr/bin/perl -w use strict; my $file = "/dave/MVPTEST/mvpdoc"; print "DateSearch = d\n"; print "Timesearch = t\n"; my $choice; do { print "Make Your Choice: "; chomp( $choice = ); } until ( $choice =~ /^[DdTt]/ ); chomp(my $data = ); # this will be the date or the time open FILE, "< $file" or die "Cannot open $file for reading $!"; foreach my $line () { my ( $in_date, $in_time ) = (split /\s+/, $line)[4,5]; if ( ( $choice =~ /^[dD]/ && $data eq $in_date ) || ( $data eq $in_time ) ) { print "\n$line\n"; } } close FILE;