|The stupid question is the question not asked|
(Ovid) Re(2): Another Q about piping Perlby Ovid (Cardinal)
|on Oct 12, 2001 at 03:39 UTC||Need Help??|
Some people consider using map on empty context is bad form. I don't.
I think it depends on the context. If you're doing a short one-liner like that, it's not a big deal. In fact, if you're just writing a small "throw away" script that only gets used once or twice and you don't care about performance or memory, then it's not a big deal IMHO. However, if you're writing large applications, it pays to be rigorous. Creating a bunch of only to throw away the return value is a waste of resources and a for loop is preferable. Doing what you did to print all the files in the $HOME/MAIL/ directory:
Side note: since I tested that on a Windows box and it doesn't like single quotes on the command line and I hate using \" all the time to embed quotes, I wrote this:
No wonder people say Perl has too much punctuation :)
Update: Hmm... seems I wasn't paying attention to blakem's post.
Vote for paco!
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.