>$grand_total += total1;
>$grand_total += total2;
>$grand_total += total3;
>$grnad_total += total4;
> ^^^
>
>$grnad_total is used only once and is most likely a tupo.
"use strict" should complain about that, even without warnings turned on. Assuming
that you never declared $grnad_total, of c
> "RN" == Ranga Nathan <[EMAIL PROTECTED]> writes:
RN> I keep getting bogus messages like:
RN> Name "ams::uscs_trailer_out" used only once: possible typo at
RN> /local/bax/test/uscs_client.pl line 137.
RN> Name "ams::uscs_header_out" used only once: possible typo at
RN> /local/bax/
Dear Chris,
> If you define a variable & use it only once, the compiler will complain.
No, it won't. At least not the perl "compiler".
For perl, an assignment (== definition) is also a use.
=begin repeated_example
--\/BEGIN-\/--
% perl -
hi
( 04.06.07 13:35 -0700 ) Ranga Nathan:
> But why should the compiler care if I used a variable only once? Why does
> it suspect it as a typo? I think I need to do something here to satisfy
> the compiler. But I am not sure what it is!
perldoc perllexwarn
--
\js "don't panic"
_
The compiler doesn't but it thinks you do :-)
$grand_total += total1;
$grand_total += total2;
$grand_total += total3;
$grnad_total += total4;
^^^
$grnad_total is used only once and is most likely a tupo.
On 2004.06.07 16:35, Ranga Nathan wrote:
But why should the compiler care if I used a varia
On Mon, 7 Jun 2004, Ranga Nathan wrote:
But why should the compiler care if I used a variable only once?
Because the rest of your program may have $foobar 42 times, but this one
line has $foobaz, and the compiler can't be sure that that's a mistake,
but chances aren't bad that that odd one out ma
Dear Mike,
> To "use a variable" means to have it on the RHS, usually. LHS only counts
> as defining it.
In computer science, yes. In perl (surprise!) no.
--\/BEGIN-\/--
% perl -lwe '$x = "hi";'
Name "main::x" used only once: possible typ
06/07/2004 01:09 PM
To: Ranga Nathan <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED]
Subject: Re: [Boston.pm] Variable used only once warning
--- Ranga Nathan mumbled on 2004-06-07 11.49.43 -0700 ---
> I keep getting bogus messages like:
> Name &quo
--- Ranga Nathan mumbled on 2004-06-07 11.49.43 -0700 ---
> I keep getting bogus messages like:
> Name "ams::uscs_trailer_out" used only once: possible typo at
> /local/bax/test/uscs_client.pl line 137.
> Name "ams::uscs_header_out" used only once: possible typo at
> /local/bax/test/uscs_client.p
I keep getting bogus messages like:
Name "ams::uscs_trailer_out" used only once: possible typo at
/local/bax/test/uscs_client.pl line 137.
Name "ams::uscs_header_out" used only once: possible typo at
/local/bax/test/uscs_client.pl line 137.
even though I have:
package ams;
..
our $SOH = chr(
10 matches
Mail list logo