Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Getting Value from joining 2 variables

by Noverast (Initiate)
on Jan 02, 2011 at 15:06 UTC ( #880077=note: print w/replies, xml ) Need Help??


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

Thanks, This did the trick. I also included: use strict; use warnings;

  • Comment on Re^3: Getting Value from joining 2 variables

Replies are listed 'Best First'.
Re^4: Getting Value from joining 2 variables
by Anonyrnous Monk (Hermit) on Jan 02, 2011 at 15:33 UTC
    ... I also included: use strict; use warnings;

    Really?  With use strict it should've stopped working

    #!/usr/bin/perl use strict; use warnings; our $pax_1 = "foo"; my $plus = 1; my $name = "pax_$plus"; my $paxing = ${$name}; print "$paxing\n"; __END__ Can't use string ("pax_1") as a SCALAR ref while "strict refs" in use +at ./880063.pl line 8.

    unless you also disable strict refs, e.g. as follows

    #!/usr/bin/perl use strict; use warnings; our $pax_1 = "foo"; my $plus = 1; my $name = "pax_$plus"; my $paxing; { no strict 'refs'; $paxing = ${$name}; } print "$paxing\n"; # "foo"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-12-08 02:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?