in reply to appending a variable
You need to use braces as you have with the other variables to detach the trailing underscore from the variable name.
use strict; use warnings; my $opstr = '01'; my $foo = "a_${opstr}_b"; print "$foo\n";
If you remove the braces even this short snippet will not compile.
🦛
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: appending a variable
by Marshall (Canon) on Apr 28, 2022 at 20:17 UTC | |
by Fletch (Bishop) on Apr 28, 2022 at 20:24 UTC | |
by pragovnj (Acolyte) on Apr 28, 2022 at 21:13 UTC | |
by hippo (Archbishop) on Apr 28, 2022 at 21:35 UTC | |
by pragovnj (Acolyte) on Apr 28, 2022 at 22:26 UTC | |
|