Sayed, Irfan (Irfan) wrote:
> Hi All,

Hello,

> Following is the code which i am executing but i am not getting the
> output of command my $out = system($cmd); into the file.
>  
>  
> #########/usr/atria/bin/Perl -w
>  
> use strict;
> use warnings;
> my $CT = "/usr/atria/bin/cleartool";
> my @vob_list = `$CT lsvob -s`;
>  
> my $fname  = "/tmp/vob_trigger";
> open FILE,">>",$fname or die $!;
>  
> foreach (@vob_list)
> {
> print "Following are the triggers applied for $_ VOB\n\n";
> my $cmd = "$CT lstype -kind trtype -invob $_";
> my $out = system($cmd);
> print FILE $out;
> print "***********************************************\n\n";
> }

Use a piped open to get the results you want:

foreach ( @vob_list ) {

    print "Following are the triggers applied for $_ VOB\n\n";

    my @cmd = ( $CT, 'lstype', '-kind', 'trtype', '-invob' $_ );

    open my $out, '-|', @cmd or die "Cannot open pipe from '$CT' $!";

    print FILE while <$out>;

    close $out or warn $! ? "Error closing '$CT' pipe: $!"
                          : "Exit status $? from '$CT'";

    print "***********************************************\n\n";
}




John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to