Re: Assistance with perl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 2/3/22 09:21, H wrote:
On 02/03/2022 08:39 AM, Joe Kline wrote:
I avoid using ' or " in one-liners or even programs.

I use q() or qq().

These are quote-like operators for single quote and double quote.

There are, of course, many more:

https://perldoc.perl.org/perlop#Quote-and-Quote-like-Operators

gizmo
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos

Thank you, I will look at those (the page says they should be q{} and q{} rather than q() and q()). It would still be useful for me to understand why my combination of single and double quotes in the perl command does not work? Just for "fun" I also tried concatenating the different strings in the perl command with . which I understand is the perl string concatenation symbol but again to no avail.

May I ask you what the correct way of including a literal $ in a substitution string would be? In bash I would precede it with a single \ but that led to loss of any text after that on that same line when used in the text string I use in my perl command, neither did preceding it with  \\ work.

I have seen that using an ENV() construct would work but I would prefer something simpler, if at all possible.

I have used literal # in my substitution string without any problems but have not gotten literal $ to work.

I think it's been pointed out that it might be a lot easier to stick with either perl or shell.

For shell you could probably do:

( cat - ; echo $txt ) >output

As for perl, I guess I'll leave that as an exercise for you how to translate from shell to perl.

For the quote-like operators you can use either () or {} for the delimiter for almost all of the quote-like operators, in fact, from the doc:

"In the following table, a {} represents any pair of delimiters you choose."

gizmo
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux