The following code (which I'm sure can be greatly improved) works but 
generates a warning "useless use of private variable in void context"  at 
two lines.  I checked the diagnostic message out in "Perl" but still don't 
understand why it is flagged.  Can anyone explain why the warning message?
Thanks in advance for any help.
John B
Here's the code:
#!/usr/local/bin/perl
use warnings;
use strict;
use DBD::SQLite;
use DBI;
 my $dbh = DBI->connect("dbi:SQLite:dbname=SQLtest.dat", "", "",
 {RaiseError =>1, AutoCommit =>1});

#display contents of table
     my $all = $dbh->selectall_arrayref("SELECT 
id,month,day,year,pfname,plname,dfname,dlname,rdb_26y,
      
rdb_26n,rdb_511y,rdb_511n,rdb_514y,rdb_514n,rdb_517y,rdb_517n,rdb_520y,rdb_520n,lst478,
      
lst479,lst480,lst481,lst482,rdb_527y,rdb_527n,rdb_530y,rdb_530n,rdb_533y,rdb_533n
      FROM  answers");
     foreach my $row (@$all) {
      my
      ($id,
      $month,
      $day,
      $year,
      $pfname,
      $plname,
      $dfname,
      $dlname,
      $rdb_26y,
      $rdb_26n,
      $rdb_511y,
      $rdb_511n,
      $rdb_514y,
      $rdb_514n,
      $rdb_517y,
      $rdb_517n,
      $rdb_520y,
      $rdb_520n,
      $lst478,
      $lst479,
      $lst480,
      $lst481,
      $lst482,
      $rdb_527y,
      $rdb_527n,
      $rdb_530y,
      $rdb_530n,
      $rdb_533y,
      $rdb_533n) = @$row;

      my $count1;
      my $count2;
      my $count3;
      my $total_count;

       $count1 = grep $_ == 1, (@$row[8]);    #gateway item =>5 attacks; 
$rdb_26y
            if ($count1==1) {
                 $count2   = grep $_ == 1, 
(@$row[10,12,16,14,18,19,20,21,22]);
                     if ($count2=>2) {
                       $count3 = grep $_ == 1, (@$row[23,25,27]);
                           if ($count3=>1){
                            $total_count=($count1)+($count2)+($count3);
                           }else{
                           print "count3 is less than 1\n";
                           }     #this line is flagged with warning message 
"useless use of ..."
                  }else{
                  print "count2 is less than 2\n";
                 }        #this line is flagged with warning message 
"useless use of ..."

       }else{
       print "patient has not indicated 5 or more attacks\n";
       }
       print "total count is $total_count\n";
       print "patient shows high probability of xxx condition.\n";
}
#disconnect
 $dbh->disconnect;



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


Reply via email to