Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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: $!";

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032629]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2018-04-26 22:21 GMT
Find Nodes?
    Voting Booth?