On Fri, Jan 29, 2016 at 12:39 AM, Jorge Almeida <jjalme...@gmail.com> wrote:
> Can someone help me to understand this?
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> my $s='\\n';
> print $s;
>
>
> Output:
> \n
>
> Expected output:
> \\n
>
>
> Jorge Almeida
>


From: perldoc perlop

 q/STRING/
       'STRING'
           A single-quoted, literal string.  A backslash represents a
           backslash unless followed by the delimiter or another backslash, in
           which case the delimiter or backslash is interpolated

so, you'll need: my $s = '\\\\n'

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to