Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: array problem

by Trimbach (Curate)
on Mar 15, 2002 at 02:18 UTC ( #151888=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://151888]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2021-10-17 01:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (70 votes). Check out past polls.

    Notices?