use File::Find; find (\&wanted, @ARGV); sub wanted { return unless /\.jpe?g$/i; print "Found $_\n"; }