Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: How does this code work? (from "Perl is Unix")

by Aristotle (Chancellor)
on Nov 07, 2009 at 03:35 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://805614]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2024-04-18 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found