develooper Front page | perl.perl5.porters | Postings from November 2000

Re: [ID 20001130.012] Can't do '\'?

Thread Previous | Thread Next
From:
Ronald J Kimball
Date:
November 30, 2000 13:32
Subject:
Re: [ID 20001130.012] Can't do '\'?
Message ID:
20001130163031.E137295@linguist.dartmouth.edu
On Thu, Nov 30, 2000 at 04:24:59PM -0500, Casey R. Tweten wrote:
> Today around 4:19pm, Ronald J Kimball hammered out this masterpiece:
> 
> : Perhaps you meant to escape the backslash?
> : 
> : print '\\';
> 
> I expected this to work too but:
> 
> [ctweten@ctweten ctweten]$ perl -le "print '\'"
> Can't find string terminator "'" anywhere before EOF at -e line 1.
> [ctweten@ctweten ctweten]$ perl -le "print '\\'"
> Can't find string terminator "'" anywhere before EOF at -e line 1.
> [ctweten@ctweten ctweten]$ perl -le "print '\\\'"
> \
> [ctweten@ctweten ctweten]$
> 
> This is behavior in bleadperl, 5.6 and 5.5.3  I would consider:
> 
>   print '\\';
> 
> to be broken.

That's an issue with your shell, which is converting the double backslash
to a single backslash before executing perl, because you're using a
double-quoted string on the command line.  Try switching the quotes around.

Ronald


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About