Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: exec, system, or backticks (or open)

by jmanning2k (Pilgrim)
on Oct 22, 2004 at 14:43 UTC ( [id://401495]=note: print w/replies, xml ) Need Help??


in reply to exec, system, or backticks

Reading the other comments, it appears you do want the output. Backticks will work well for this situation, but not the way you used them. Try:
$key = `$sxwbt_dms $item`
instead of the shell redirection.
This runs the entire program, and then gives you all the output.
If your program would do well reading the output line by line as the program outputs it, you will get a faster response with an open call. Just follow the program name with a pipe character, and perl will attach to the program's STDOUT.
open(SWBT, "$swbt_dms $item |") while(<SWBT>) { process_line($_); }
But that depends on if you need the entire results, or you want to process it line by line. It is just yet another way to read output from a program, but since it hasn't yet been mentioned, and has the advantage of line-by-line processing, I thought I'd mention it.
~J

Log In?
Username:
Password:

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

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

    No recent polls found