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

Backticks (Was: Re^2: Is this the most elegant way to code directory lookup?)

by LittleGreyCat (Scribe)
on Oct 03, 2006 at 10:12 UTC ( [id://576022]=note: print w/replies, xml ) Need Help??


in reply to Re: Is this the most elegant way to code directory lookup?
in thread Is this the most elegant way to code directory lookup?

"Finally (and most importantly) using backticks for commands where you're not capturing the output is wasteful as Perl collects up all the output and returns it to you - only for you to throw it away. Better to use system in that case. Or to use Perl version of the command where they are available - like using move (from File::Copy instead of mv)."

Be thankful that Perl throws it away. If you do the same thing in (e.g.) ksh then the command for the shell to execute is evaluated as the return from the back-ticked command. i.e. it doesn't throw the output away it executes it!

Now I can see how this might be useful in some obscure circumstances.....however I have seen back-ticks used without the realization of the implications :-(

And yes, it did take me a while to work out where the obscure error messages were coming from!

Cheers

Dave.R

Nothing succeeds like a budgie with no teeth.

2006-10-03 Retitled by planetscape, as per Monastery guidelines: one-word (or module-only) titles hinder site navigation

( keep:1 edit:7 reap:0 )

Original title: 'Re^2: Backticks'

  • Comment on Backticks (Was: Re^2: Is this the most elegant way to code directory lookup?)

Log In?
Username:
Password:

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

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

    No recent polls found