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


in reply to Re^6: Find images regardless of filetype extension.
in thread Find images regardless of filetype extension.

Compactness affects readability. And besides, you're counting declarations and braces as lines, if I put it on one line it doesn't mean it's a single statement... if you're looking for compactness, here goes:

I'll assume @files and @dirs are already declared then.
map {$d="$dir/$_";$r= -d $d?\@dirs:\@files;push @$r,$d;} grep {!/^\./} + readdir DIR;

Yes, this uses map in void context, but you want compactness, not efficiency :)


He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
Chady | http://chady.net/
Are you a Linux user in Lebanon? join the Lebanese GNU/Linux User Group.