http://www.perlmonks.org?node_id=151888


in reply to array problem

A couple more suggestions. Instead of
opendir DIR, "$dir"; my @arr = grep -f, grep /\.jpg$/i, map "$dir/$_", readdir DIR;
you can do the same much more simply by just
my @arr = glob("*.jpg");
See "perldoc -f glob" for more information.

Also, when you call a subroutine you're gonna wanna do a &print_it or print_it(), but not a &print_it(). They are different, but you only have to tell Perl it's a subroutine once. :-D

Gary Blackburn
Trained Killer