Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Getting Value from joining 2 variables

by moritz (Cardinal)
on Jan 02, 2011 at 13:30 UTC ( #880072=note: print w/replies, xml ) Need Help??


in reply to Re: Getting Value from joining 2 variables
in thread Getting Value from joining 2 variables

"$pax_$plus" simply creates a string. If $pax is "foo", and $plus is "100", then "$pax_$plus" creates the string "foo_100"

Not at all. It tries to look up the variable $pax_ (since an underscore is valid part of a variable name), and fails (and thus interpolates the empty string for $pax_).

use strict; use warnings; would have caught the problem, and can only be highly recommended to Noverast.

Replies are listed 'Best First'.
Re^3: Getting Value from joining 2 variables
by ELISHEVA (Prior) on Jan 02, 2011 at 13:47 UTC

    Good catch!

    I frequently trip on that one and also $sClass::Blah when I mean ${sClass}::Blah. Thanks.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2023-01-28 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?