On Fri, Jan 29, 2016 at 2:48 AM, Charles DeRykus <dery...@gmail.com> wrote: > 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 >
Thank you, this section of the documentation is clear enough. Unfortunately, I never found any other text about the difference between single and double quotes that alerts to this violation of the principle of least surprise. My fault for not relying exclusively on the official documentation. Thanks again, the mystery is explained. Jorge -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/