On Monday, Nov 17, 2003, at 07:37 US/Pacific, Jeff Westman wrote: [..]
In my limited experience with perl, I've never had to use[..]
the 'amp' command, even though I see it used all the time.
It seems to just be a short-cut of other commands/keywords that I've used.
So, when do you HAVE to use 'map', when no other option makes sense?!
in terms of 'have to' - the answer is 'never', since as the documentation "perldoc -f map" notes, it is a 'cool way' to do
%hash = (); foreach $_ (@array) { $hash{getkey($_)} = $_; }
where the 'getkey()' is some function that solves what the key for that hash should be given the input...
One place that we all use it is in the Schwartzian Transformation: cf <http://www.mrflip.com/resources/perl/Perl.html>
Yes, you could write that longer, but, well, there is a sense of elan and elegance in it that is 'cool'.
So the real trade off is whether you need the 'verbosity' of writing out the longer form to make your code clear for the person coming along behind you to maintain it. Or is it the sort of problem that needs something a bit different from the standard grep tricks.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]