use strict; use File::Find; @ARGV = '.' unless @ARGV; find sub { # do something with $_ # which is the name of the current file print "got one!\n" if m/\.mp3$/; }, @ARGV;