List Info

Thread: How do I tell perl -w: "I really want to use this var just once"




How do I tell perl -w: "I really want to use this var just once"
user name
2006-12-19 00:49:32
perl -w dings me if I use a variable just once:

Name "main::foo" used only once: possible typo...

even if I'm magically defining/using $foo somewhere else.

Is there any way to tag a variable to tell the -w option
that I'm
intentionally using that variable just once, and not to warn
me about it?

I realize I could do something like: "$foo = $foo"
to force the issue,
but that seems kludgy.

-- 
We're just a Bunch Of Regular Guys, a collective group
that's trying
to understand and assimilate technology. We feel that
resistance to
new ideas and technology is unwise and ultimately futile.


Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 
How do I tell perl -w: "I really want to use this var just once"
user name
2006-12-19 02:03:36
On 12/18/06 7:49 PM, Kelly Jones at kelly.terry.jonesgmail.com
wrote:

> perl -w dings me if I use a variable just once:
> 
> Name "main::foo" used only once: possible
typo...

I guess it's warning you in case you meant to use it more
than once but
misspelt it here or elsewhere. You could get rid of warnings
by nt using -w,
but then you wouldn't get warnings ...






Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 
How do I tell perl -w: "I really want to use this var just once"
user name
2006-12-19 11:03:05
--- In perl-beginner@yahoogroups.com, "Kelly
Jones"
<kelly.terry.jones...> wrote:
>
> perl -w dings me if I use a variable just once:
> 
> Name "main::foo" used only once: possible
typo...
> 
> even if I'm magically defining/using $foo somewhere
else.
> 
> Is there any way to tag a variable to tell the -w
option that I'm
> intentionally using that variable just once, and not to
warn me
about it?
> 
> I realize I could do something like: "$foo =
$foo" to force the issue,
> but that seems kludgy.
> 
If you use "my $foo" you won't get the warning
message.

Why are you declaring the variable if you are not using?
What purpose
does that line of code serve?



Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )