in reply to Quickly reading the first line of a large number of files...

Obviously I can open each file and check the first line, but this is time consuming.

I can't think of any other way of doing it without "something" having to open the file!
my @perlscripts; foreach (@files) { open HANDLE, $_ or die "can't open $_"; push @perlscripts, $_ if <HANDLE> =~ /^#!/; close HANDLE; } print $_, "\n" for @perlscripts;
Error: Keyboard not attached. Press F1 to continue.