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

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

Thread Previous | Thread Next
From:
John Peacock
Date:
November 30, 2000 13:33
Subject:
Re: [ID 20001130.012] Can't do '\'?
Message ID:
3A26C78B.939141D@rowman.com
Just for the fun of it, I tried it under 5.6.0 on NT:

D:\>perl -le "print '\\'"
\

And under VMS:

KES-JPEACOCK> perl -le "print '\\'"
\

Hmmm, appears to be a Unix only thing.  It is likely that the Unix 
shell is causing problems since there is no problem when running in 
the debugger:

[root@vir named]# perl -lde 1
Default die handler restored.

Loading DB routines from perl5db.pl version 1.07

Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):   1
  DB<1> print '\\'
\


John Peacock

"Casey R. Tweten" wrote:
> 
> Today around 4:19pm, Ronald J Kimball hammered out this masterpiece:
> 
> : On Thu, Nov 30, 2000 at 04:11:38PM -0500, WWW server user wrote:
> : > A _very_ simple perl program:
> : >
> : >    print '\';
> : >
> : > causes
> : >    "Can't find string terminator "'" anywhere before EOF at blah line 1."
> :
> : That is the correct behavior.  The backslash escapes the second quote, so
> : you are missing the terminating quote.
> :
> : 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.
> 
> --
> 
> print(join(' ', qw(Casey R. Tweten)));my $sig={mail=>'crt@kiski.net',site=>
> 'http://home.kiski.net/~crt'};print "\n",'.'x(length($sig->{site})+6),"\n";
> print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys%{$sig};
> my $VERSION = '0.01'; #'patched' by Jerrad Pierce <belg4mit at MIT dot EDU>

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