pseudo code: #!/usr/bin/perl -w use strict; use warn; my $REF; my @LINES; my $DPT_DIR=/shares/test/PPdir/ print "ENTER REF NUMBER"; chomp($REF = <>); grep "$REF" */*.dpt open my $FH, '<', *.dpt file grep has found chomp(@LINES, $FH); close $FH #### Linux grep: #grep -l ABC123 */*.dpt lloydf/test.dpt <-- I need to read this file.