Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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.


Comment on Re: How does this code work? (from "Perl is Unix")
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://805614]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2014-10-30 16:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls