John W. Krahn wrote:
> Sayed, Irfan (Irfan) wrote:
>>Hi All,
> 
> Hello,
> 
>>I have a following script in perl in which i am using awk command but it
>>is not getting executed properly.
>> 
>> 
>># /usr/atria/bin/Perl -w
>> 
>>use strict;
>>use warnings;
>> 
>>my $fname  = "/tmp/checkvob_log";
>>open(FILE,">>$fname");
>> 
>>
>>my $CT = "/usr/atria/bin/cleartool";
>> 
>>my @vob_list = `$CT lsvob -s`;
>> 
>>my @vob_list1 = `$CT lsvob`;
>> 
>>print FILE @vob_list1;
>> 
>>my $cmd1 = "awk '{print $3}' /tmp/checkvob_log";
>> 
>>my @vob_path = qx{$cmd1};
>> 
>>print @vob_list;
>>print @vob_path;
> 
> Why not just do that in perl:
> 
> 
> #!/usr/atria/bin/Perl
> use strict;
> use warnings;
> 
> my $fname  = '/tmp/checkvob_log';
> open FILE, '>>', $fname or die "Cannot open '$fname' $!";
> 
> my $CT = '/usr/atria/bin/cleartool';
> 
> my @vob_list = `$CT lsvob -s`;
> 
> my @vob_list1 = `$CT lsvob`;
> 
> print FILE @vob_list1;
> 
> open FILE, '<', $fname or die "Cannot open '$fname' $!";
> 
> my @vob_path = map { ( split )[ 2 ] } @vob_list1;

Correction:

my @vob_path = map { ( split )[ 2 ] } <FILE>;


> print @vob_list;
> print @vob_path;


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