Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
    "Not using the shell for the sake of not using the shell is very unPerlish"

<Sigh> -- Not exactly what I meant, but because you may have misunderstood my intended message, let me rephrase it:  Why go to the shell when you can do it just as easily in Perl?

Of course I use the shell when it makes sense.  Without hesitation.  But it's not a good idea (for a number of reasons) to get in the habit of blindly running to the shell without considering the alternatives.  One reason the comes to mind is portability.  Another is speed.

And yes, I'm aware that in a little program that uses the shell for nothing other than stripping the basename from its own path there is unlikely to be noticeably slower than its alternative.  But what if your script is so useful that some other program now calls it thousands or millions of times?  And some other program calls that one thousands or millions of times?  Eventually you run the risk of encountering leaky abstractions.

I'll confess, there are plenty of times I've done:

% cat somefile | grep somestring

But I still try to be aware that it's overkill, just like instinctively using the shell (when you don't necessarily have to) can be.


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re^3: It's the little things... by liverpole
in thread It's the little things... by Lady_Aleena

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-19 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found