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"