in reply to Re^3: Getting Value from joining 2 variables
in thread Getting Value from joining 2 variables
... 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"
|
---|
In Section
Seekers of Perl Wisdom