msh210 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Monks,
I have a bunch of scalar variables to include in a string. In order to avoid a bunch of ugly concatenation dots, I include them all in a double-quoted string. So far, so good. But one of the variables is to be followed, within the string, by some (non-variable alphanumeric) text. Obviously, I can't just concatenate them within the double-quoted string. Two options I can think of are:
But I don't much like either of those. The first is a bit ugly/inelegant to my mind: I prefer one long double-quoted string. The second is dependent on a variable that may change in a later revision of the script; plus, it's distasteful to me because there's nothing tying $\ to this string semantically.
Is there a more elegant way of doing this? Or is my option 1 (or 2?) considered elegant enough?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to include a string immediately after a variable in a double-quoted string
by dave_the_m (Monsignor) on Nov 20, 2015 at 21:13 UTC | |
|
Re: How to include a string immediately after a variable in a double-quoted string
by stevieb (Canon) on Nov 20, 2015 at 21:14 UTC | |
|
Re: How to include a string immediately after a variable in a double-quoted string
by jeffa (Bishop) on Nov 20, 2015 at 21:44 UTC | |
by stevieb (Canon) on Nov 20, 2015 at 22:54 UTC | |
by msh210 (Monk) on Nov 22, 2015 at 04:57 UTC | |
|
Re: How to include a string immediately after a variable in a double-quoted string
by msh210 (Monk) on Nov 20, 2015 at 21:16 UTC |