Perl: Quick Shorthand to Read Directory Listing
Perl has various shortcuts in order to do routine tasks. A favorite of mine is the shorthand syntax to open a directory and read its contents.
Note: Only applies to current working directory.
The Code:
@files = <*>;
foreach $file (@files) {
//do whatever
}
Written by Jason Balthis
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Perl
Authors
janosgyerik
25.11K
Jean-Remy Duboc
12.22K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#