The stupid question is the question not asked | |
PerlMonks |
forcing list-contextby morgon (Priest) |
on Jan 23, 2012 at 14:32 UTC ( [id://949420]=perlquestion: print w/replies, xml ) | Need Help?? |
morgon has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I need to find the number of entries in a directory, so I do this: What bugs me is the "grep {1}"-thing that I do for the sole purpose of forcing a list-context on the readdir as doing simpy a $entries = scalar (readdir $dh) (i.e. putting paentheses around the call) does not do the trick... So I wonder now: What is the idiomatic way to force list-context? Many thanks!
Back to
Seekers of Perl Wisdom
|
|