Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Running a script iteratively.

by Fletch (Bishop)
on Apr 24, 2008 at 14:48 UTC ( [id://682641]=note: print w/replies, xml ) Need Help??


in reply to Re: Running a script iteratively.
in thread Running a script iteratively.

Eeeew. Backticks in void context? Use the right tool for the job.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^3: Running a script iteratively.
by moklevat (Priest) on Apr 24, 2008 at 14:53 UTC
    I said it was non-robust. Perhaps I should have described it as "icky" instead?

      Robustness aside (as it suffers from the same lack of error checking the other proffered version below with system has :), it doesn't express the intent behind the code correctly. Backticks are for capturing the output from an external program; system is for starting an external program who's output you don't care about.

      It's like using map in void context to iterate over a list in place of for; yes it "works", but if the line of code is not building a new list of values from an existing list then you're using the wrong "phrasing" (by which I mean 'not the clearest') to express your intent (map is for expressing transformation, for is for expressing iteration).

      (And I won't go into the "PERL scripts" I've seen that basically consisted of a shebang line and then every line was shell commands in backticks . . . *shudder* :)

      Update: Tweaked for perldoc link somewhere more relevant per prodding from kyle.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

Re^3: Running a script iteratively.
by Zen (Deacon) on Apr 24, 2008 at 19:55 UTC
    TIMTOWTDI

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-18 07:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found