in reply to Re^2: Searching for files efficiently help!
in thread Searching for files efficiently help!

If I understand, you can simply narrow your regex to match up to the first underscore, and see if that 'exists':

foreach my $files(@files) { $c++; if($files=~m|.*/([^_]+)|) { $f_name = $1; } if (exists $filelist{$f_name}) { print "$c - Found and to be deleted: $files\n"; } }

I might go as far as:

for (@files) { $c++; if(m|.*/([^_]+)| && exists $filelist{$1} ) { print "$c - Found and to be deleted: $_\n"; } }

Replies are listed 'Best First'.
Re^4: Searching for files efficiently help!
by Anonymous Monk on Nov 16, 2011 at 20:17 UTC
    I like this, thanks very much!