use strict; print"Please type the term you're looking for\n"; chomp (my $cho = ); open (FILE, "<", $ARGV[0]) || die "$!"; $/ ="(.*)\n(.*)\n(.*)"; while (){ m/(.*)\n(.*)\n(.*)/gi; next if (!m/(.*)\n$cho\n(.*)/ ); print "$1\n$cho\n$2"; } $/ = "\n";