#!/usr/bin/perl use warnings; use strict; use File::Find; find(sub { if (-d and /[oa]-le-v7(-g)?$/) { print "No matching files in $File::Find::dir/$_\n" unless grep { /\.(o|a|so)$/ } glob "$_/*"; } }, "testdir" );