E
ed
Hi all. Up until recently I've been avoiding things like grep and
map.
But now I'm starting to use them, and really see their appeal.
I've read the faq: "What's wrong with using grep or map in a void
context?"
But was wondering if anyone could point me to examples of these
functions
being used in void and non-void context.
For example, is the code below ok?
The list grep creates _is_ used, but it isn't assigned to a variable.
foreach my $currentFilePath ( grep{!/^\.{1,2}$/} readdir(DIR) )
{ # .. do stuff with $currentFilePath
}
tia,
--ed
map.
But now I'm starting to use them, and really see their appeal.
I've read the faq: "What's wrong with using grep or map in a void
context?"
But was wondering if anyone could point me to examples of these
functions
being used in void and non-void context.
For example, is the code below ok?
The list grep creates _is_ used, but it isn't assigned to a variable.
foreach my $currentFilePath ( grep{!/^\.{1,2}$/} readdir(DIR) )
{ # .. do stuff with $currentFilePath
}
tia,
--ed