On Fri, Jan 29, 2016 at 12:39 AM, Jorge Almeida <[email protected]> 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: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/