Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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??


in reply to How does this code work? (from "Perl is Unix")

Just for completenessí sake, that strip function code is a condensed syntactic (near) equivalent of this function:

sub strip { my @r = @_; for ( @r ) { s/\A\s+//; s/\s+\z//; } return @r; }

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://805614]
help
Chatterbox?
[erix]: that's bad... I can only wish you good luck
[Discipulus]: not even in Canada is easy to find a decent job
Discipulus was a question
[GotToBTru]: current job found me
Discipulus is so lucky to have a decent job, with old, favorable contract, done before the ultralibersm arrived in Eataly

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2017-05-23 19:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?