Geetha Weerasooriya wrote:
>
> In my perl code for MapMatching, I have following while loop. When I run
> the program I get the following two error messages(for each data line in
> the data file)
> But the out put file is created.
>
> Use of uninitialized value in int at filename.pl lineNo, <DATA> line ..
> Use of unititialized value in multiplication(*) at filename.pl lineNo,
> <DATA> line ..
>
> The errors refer to the lines  in bold in the code
>
> Can you please  teach me where the error is?
>
> Kind regards,
>
> Geetha
>
>
>
> while(<DATA>)  {
>             chop;
>             s/\s//g;
>
> /\d+\/\d+\/\d+,\d+:\d+:\d+,\d+,(\d+\.*\d*),(\d+\.*\d*),\d+,\d+,\d+,\d+\.
> *\d*,\d+$/
>                         or die "Error in mtchSq2Route.pl! bad format in
> SQ record.\n$_\n";
>             $lngi_bgn = $1;
>             $lati_bgn = $2;
>
>              my ($rt1,$dist1,$pos1) = &getFootPointDistToRoot($lngi_bgn,
> $lati_bgn);
>
>              $pos1 = int($pos1);
>              $dist1 = int($dist1*100)/100;
>
>             print "$_,$rt1->{ID},$pos1,$dist1\n";

Hello Geetha

Don't forget that we can't see bold emphasis on the mailing list: the posts are
converted to plain text by the server. But your errors must be on the lines

>   $pos1 = int($pos1);
>   $dist1 = int($dist1*100)/100;

and are because $pos1 and $dist1 are undefined, so you should look at function
getFootPointDistToRoot() which is returning this value. Despite the warnings,
the undefined variables will evaluate as zero and so may be giving you the
results you expect. Nevertheless these should clearly be numeric values and
either the function needs correcting or, if you have no access to make changes
there, the returned values should be explicitly forced to zero with

  $pos1 != '0';
  $dist1 != '0';

But please do this as a last resort and be sure that it is what you mean.

HTH,

Rob

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