Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: ClearCase Command text in Backticks is ignored

by runrig (Abbot)
on May 08, 2013 at 16:01 UTC ( #1032629=note: print w/ replies, xml ) Need Help??


in reply to ClearCase Command text in Backticks is ignored

Are you sure $stream is set to what you think it is?

If you don't need to capture output and just want it to go to stdout, use system(@array):

# Not sure if you are trying to pass literal '\t','\n' or tab and newl +ine characters...assuming tab and newline system(cleartool => 'lsco', '-r', '-brt', $stream, '-fmt', "%En\t%u\n" +);

If you want to capture stdout, open a file handle to the command:

open(my $fh, "-|", cleartool => 'lsco', '-r', '-brt', $stream, '-fmt', "%En\t%u\n") or +die "Err: $!"; while (<$fh>) { print "OUTPUT: $_"; } close $fh or die "Error: $!";


Comment on Re: ClearCase Command text in Backticks is ignored
Select or Download Code
Re^2: ClearCase Command text in Backticks is ignored
by Deep_Plaid (Acolyte) on May 08, 2013 at 16:56 UTC

    I see what you mean, Ken. I was thinking System passed the output of the command to the variable $output, but I do remember reading now that it passes the error code. I had thought I was printing the output of system, but it was actually passing the error code! I removed the printf and all is good. Thanks again. You guys rock! I'm a newbie, obviously.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2014-10-30 16:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls