On 4/17/06, Irfan J Sayed <[EMAIL PROTECTED]> wrote:
snip
> I want to catch the output of this system command in the file
snip

TIMTOWTDI

#shell redirection
foreach my $vob (@vob_list) {
    system "cleartool lock vob:$vob >> output";
}

#store in array
my @output;
foreach my $vob (@vob_list) {
    push @output, qx{cleartool lock vob:$vob};
}
open my $out, '>', 'output';
print $out @output;
close $out;

#output as you go
open my $out, '>', 'output';
foreach my $vob (@vob_list) {
    print $out, qx{cleartool lock vob:$vob};
}
close $out;

I like the third option the best because it is easy to add error checking to.

--
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