|
|
| Don't ask to ask, just ask | |
| PerlMonks |
Re: How does this code work? (from "Perl is Unix")by Aristotle (Chancellor) |
| on Nov 07, 2009 at 03:35 UTC ( #805614=note: print w/ replies, xml ) | Need Help?? |
|
Just for completeness’ sake, that strip function code is a condensed syntactic (near) equivalent of this function:
But I didn’t want to spend 6 lines on a routine that is completely incidental to the main point of the code, and which I put there only to emulate the exact behaviour of the Ruby and Python counterparts. If it were in a module with string functions, I would write it in the long-hand form. Programming is writing and code is literature. Sometimes you need to linger on the details and sometimes they would only derail the pacing. Makeshifts last the longest.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||