[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 20000112.002] "Used only once" doesn't recognize arguement passing



japhy@pobox.com writes:
: On Jan 12, Kenneth Kron said:
: 
: > The following code fragment incorrectly reports NPORTS only used once
: > when it is passed to a subroutine
: 
: Probably because Perl expects the NPORTS filehandle to be passed as
: *NPORTS or \*NPORTS, unless the GetPortList function has been prototyped
: to take a glob as its first argument.

Even with a prototype, calling the function using & would defeat it.
So what you're basically doing is passing a bareword (an unquoted string),
that just happens to get interpreted later as an indirect file handle.
Note that under "use strict" you're not allowed to use a bareword that
way at all.  If you ever plan to add "use strict", start passing your
filehandles as *NPORTS or \*NPORTS now, or you'll have a bunch of cleanup
to do later.

Larry


References to:
Jeff Pinyan <jeffp@crusoe.net>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]