I've got a perl script with something like the following:
" \"blah\@$string;blah\" "
But I'm not sure what the \@
is doing/supposed to do.
I've tried googling '\@
' but I can't seem to find anything.
The backslash is the escape character and is used to make use of escape sequences. When there is a need to insert the escape character in an interpolated string, the same backslash is used, to escape the substitution of escape character with ” (blank). This allows the use of escape character in the interpolated string.
Escaping the escape character If you put a back-slash \ in a double-quoted string, Perl will think you want to escape the next character and do its magic.
The aim of creating a special sequence is to make the code more readable and shorter. The Special Character Classes in Perl are as follows: Digit \d[0-9]: The \d is used to match any digit character and its equivalent to [0-9]. In the regex /\d/ will match a single digit.
my $var = "\\n"; $var =~s/\\//g; print "$'"; Else If you want print the \n . Just use the single quotes instead of double quotes. or use forward slashes within double quotes.
It causes the @
to mean "An at sign" instead of "Dereference $string
as an arrayref".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With