Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: typo? variable misteriously becoming undef

by John M. Dlugosz (Monsignor)
on Nov 14, 2002 at 20:04 UTC ( [id://212994]=note: print w/replies, xml ) Need Help??


in reply to typo? variable misteriously becoming undef

1) don't do eq undef. That's nonesence. You cannot compare something directly against undef (so I've read somewhere around here) but should only test it directly.

2) Your shift @la gets rid of the OH and moves everything else down one. I don't see a $la[1] anywhere, so guess what? I don't see why it's not already gone at the first print.

Replies are listed 'Best First'.
Re: Re: typo? variable misteriously becoming undef
by scain (Curate) on Nov 14, 2002 at 20:11 UTC
    John,

    Thanks:

    1. It felt funny doing it, but it seemed to work, so I left it.

    2. Just to clarify: The first time through the loop, $la[0] contains "Medina, OH", then I do a split /\,\s*/, $la[0] and assign it back into @la, so now $la[0] should contain "Medina" and $la[1] should contain "OH". Second time through the loop, I select "5", $la[0] gets assigned into the hash, and I shift, which should bump "Medina" out, and put "OH" at $la[0].

    Scott

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-25 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found