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