Front page | perl.perl5.porters |
Postings from March 2003
[perl #21565] backslash bug: '\\' interpreted as '\'
Thread Next
From:
Per Olav Kroka
Date:
March 13, 2003 07:18
Subject:
[perl #21565] backslash bug: '\\' interpreted as '\'
Message ID:
rt-21565-53612.14.8185040334188@bugs6.perl.org
# New Ticket Created by "Per Olav Kroka (ETO)"
# Please include the string: [perl #21565]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=21565 >
The intention of my script was to find all C-style compiler directives.
Bug description:
I had to enter a quadruple backslash (\\\\) to make it interpret this as a single one in the search statement. In my opinion it should only have been a double backslash (\\) and I tried using that, but then it was interpreted as an escape character and it resulted in too few closing parantheses.
pok
My script:
==========
#!/usr/bin/perl.exe -w
use warnings;
use strict;
undef $/; #enable whole file mode
while(<>)
{
my $hash = '^[\t ]*\#(?>.+)(?:(?<=\\\\)\n.*)*\n{1}'; # # compiler directives
# ^-- The bug:
# I had to enter a quadruple backslash to make it interpret this as a single one in
# the search statement below.
print "Hash test: ";
while( /($hash)/gm )
{
print "\"";
print $1;
print "\"";
print "\n";
}
print "\n";
}
#script ends here
Version: (perl -V output)
=========================
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=cygwin, osvers=1.3.2(0.3932), archname=cygwin-multi
uname='cygwin_nt-4.0 loreley 1.3.2(0.3932) 2001-05-20 23:28 i686 unknown '
config_args='-de -Dusemultiplicity'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=define
useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include',
optimize='-O2',
cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.3-5 (cygwin special)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='ld2', ldflags =' -s -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib
libs=-lgdbm -lcrypt
perllibs=-lcrypt
libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl5_6_1.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s'
cccdlflags=' ', lddlflags=' -s -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Built under cygwin
Compiled at Aug 22 2001 01:05:05
@INC:
/usr/lib/perl5/5.6.1/cygwin-multi
/usr/lib/perl5/5.6.1
/usr/lib/perl5/site_perl/5.6.1/cygwin-multi
/usr/lib/perl5/site_perl/5.6.1
/usr/lib/perl5/site_perl
.
Thread Next
-
[perl #21565] backslash bug: '\\' interpreted as '\'
by Per Olav Kroka