you are redeclaring $scount .... 

my ($scount,$spaces) = split /,/;     <====

should be

($scount,$spaces)

and $spaced to be priviouly declared.

"use strict;" will help this kind of issue.

cheers,

VX


-----Mensagem original-----
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] nome de
[EMAIL PROTECTED]
Enviada em: segunda-feira, 14 de fevereiro de 2005 13:27
Para: activeperl@listserv.ActiveState.com
Assunto: creating report using perl




Hi All,

I'm preparing a report using perl.
Everything seems working fine but I'm getting 0 for one number.
The code is like this...

my $outfile = "sus_reconcile.lst";
my $infile = "reconcile.txt";

my $scount;
my $tcount;
my $status;


open (READ, $infile) or die "Could not open file: $infile\n";
open (WRITE, ">$outfile") or die "Could not open file: $outfile\n";

use FileHandle;
WRITE->format_name("FILE");
WRITE->format_top_name("FILE_TOP");

format FILE_TOP = 
Target               Target Count   Source Count   Status
-------------------- -------------- -------------- ---------
.

format FILE = 
@<<<<<<<<<<<<<<<<<<< @############# @############# @<<<<<<
$tab                 $tcount        $scount        $status
.


while (<READ>)
   {
      chomp;
      my $line = $_;
      my $val;
      if (s/target,//){
         ($tab,$tcount,$spaces) = split /,/;                       
      }elsif(s/source,//){ 
         my ($scount,$spaces) = split /,/;           
         $status = $tcount==$scount?"PASS":"FAIL";         
         write WRITE;
      }
      
   }


#`perl cds_fact_recon.pl`;
   

and output is....

Target               Target Count   Source Count   Status
-------------------- -------------- -------------- ---------
 sus_ac                     5146226              0 PASS
 sus_ae_attendance          7320817              0 PASS
 sus_attender             238179239              0 PASS
 sus_birth                  8485164              0 FAIL
 sus_cds_patient          364093407              0 PASS

It is picking the number correctly as status is correct, but I'm unable
to figure out why the 'Source Count' is displayed as 0.

Any ideas...

Cheers
Tarun



_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to