sub mexicoRouteCheck{

my $interdest5 = "";

        ($cc) = @_;
        $sth_mex = $dbh->prepare("select interdest5 from mexicoRoutingCodes
                where digits = ? ");

        for($l=6; $l>3; $l--){
                $interdest5 = "";
                $sth_mex->execute( substr($cc,0, $l) );
                ($interdest5) = $sth_mex->fetchrow_array();
                last if ($interdest5 ne "");
        }
        return $interdest5;
}

I've written a test script which uses this routine. I have warnings,
strict, and diagnostics turned on.
When I execute this script, I get this message.

*Use of uninitialized value $interdest5 in string ne at test2.pl
<http://test2.pl> line 57 (#1)*

Line 57 is "last if ($interdest5 ne "");".

Why does Perl say it is uninitialized ?
I thought I took care of that in two places. Once when it was declared and
and again within the loop.


Regards,
Danny

Reply via email to