Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

perl \@ escape sequence

Tags:

escaping

perl

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.

like image 401
Seth Hoenig Avatar asked Feb 05 '12 16:02

Seth Hoenig


People also ask

How do I escape a character in Perl?

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.

How do I escape a quote in Perl?

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.

How do I insert a special character in Perl?

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.

How do I print a special character in Perl?

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.


1 Answers

It causes the @ to mean "An at sign" instead of "Dereference $string as an arrayref".

like image 178
Quentin Avatar answered Nov 07 '22 05:11

Quentin