in reply to I thought I found a good reason to use backticks in a void context, but I was wrong.

Using something in a void context means you're throwing away any return value. This may or may not be a good idea. (Hint: it's almost *never* a good idea.)

In this particular example, since Net::Ping is available as part of the Core distribution, I'd suggest using that module instead of anything that involves shelling out to the OS.

From the man page:

Sounds like it's right up your alley.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

  • Comment on Re: I think I just found a good reason to use backticks in a void context.
  • Download Code

Replies are listed 'Best First'.
Re^2: I think I just found a good reason to use backticks in a void context.
by OfficeLinebacker (Chaplain) on Jan 14, 2007 at 01:42 UTC
    Thanks for your response.

    When you use backticks in a void context, aren't you throwing away the output, while the return value is retained in $?, as with system()?

    Either way, Net::Ping might well be even faster. I'll look into it.


    I like computer programming because it's like Legos for the mind.