Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Using "my" suppresses "Name used only once" warning?by Wysardry (Pilgrim) |
on Feb 03, 2003 at 00:10 UTC ( [id://232094]=note: print w/replies, xml ) | Need Help?? |
I tend to want to pre-declare variables, as it's how I learnt in BASIC, C and COBOL. I also got into the habit of defining them before doing anything else. Obviously in large programs this can lead to some being declared but never used, or left behind when the code that uses them is removed. The using a string as a number thing was because I was testing what warnings were given and set a variable to 1 (numeric), concanated it with "1" with the . operand and then added a numeric number 1 to it, without getting any warnings about it. I know a "make your mind up about the context of $such_and_such" warning is too much to ask, but I'd have expected some sort of non-fatal complaint. I guess what I'm really after is a psuedo strong type casting option for variables. In other words, if I used a scalar in string context, I want to be warned if I later use it as a number (even if it looks like a number).
In Section
Seekers of Perl Wisdom
|
|