# A script illustrating the use of the glob function. # perldoc -f glob # # This script looks for jpg and gif files in the current directory (or in # some other directory, if you pass that as the first argument: # # perl -w glob-example.pl images/family use strict; my $dir = shift || '.'; my @jpgs_and_gifs = grep { /(\.gif|\.jpg)$/i } glob "$dir/*"; print "I found these jpg/gif files: \n"; print join ("\n", @jpgs_and_gifs); print "\n";