Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: using strict

by Fletch (Bishop)
on Mar 22, 2004 at 20:56 UTC ( [id://338762]=note: print w/replies, xml ) Need Help??


in reply to using strict

Your declarations are lexical in scope and vanish at the end of the enclosing block. Since your my declarations take place in two different blocks and you then try to access them in a third they're no longer valid. You need to declare them in the largest enclosing scope (in this case you'd want to do so at the top of the while loop outside all branches of your conditional).

On an unrelated note, using undef rather than a junk variable is better practice if you don't need one of the return values from split (or wrap the split in parens and subscript it to pull out what you want, e.g. ( $foo, $bar ) = ( split( /:/ ) )[1,4]).

Replies are listed 'Best First'.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://338762]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2024-04-19 00:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found