Closed p5pRT closed 20 years ago
hello -
i have noticed that using different delimiters on regex calls will give different results. please run the following program to illustrate. the data file "temp.txt is also included. please note the difference between m//\, m##\, m^^ and the m?? - the question marks do not seem to work.
thank you\, mark edwards
cat test.txt 12345678901234567890 12345678901234567890
cat test.pl
$my_regex = q(.{20});
open (temp \, "\<test.txt");
my $i=0;
while (\
print "regex is true with pound characters\n" if ( m#$my_regex# ) ;
print "regex is true with question mark characters\n" if ( m?$my_regex? ) ;
print "regex is true with forward slash characters\n" if ( m/$my_regex/ ) ;
print "regex is true with up carat characters\n" if ( m^$my_regex^ ) ; };
perl -V Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=hpux\, osvers=11.00\, archname=PA-RISC2.0 uname='hp-ux chromium b.11.00 u 9000899 1685432391 unlimited-user license ' hint=recommended\, useposix=true\, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc'\, optimize='-O'\, gccversion= cppflags='-D_HPUX_SOURCE -Aa' ccflags ='-D_HPUX_SOURCE -Aa' stdchar='unsigned char'\, d_stdstdio=define\, usevfork=false intsize=4\, longsize=4\, ptrsize=4\, doublesize=8 d_longlong=undef\, longlongsize=\, d_longdbl=define\, longdblsize=16 alignbytes=8\, usemymalloc=y\, prototype=define Linker and Libraries: ld='ld'\, ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib libs=-lnsl -lnm -lndbm -ldld -lm -lc -lndir -lcrypt libc=/lib/libc.sl\, so=sl\, useshrplib=false\, libperl=libperl.a Dynamic Linking: dlsrc=dl_hpux.xs\, dlext=sl\, d_dlsymun=undef\, ccdlflags='-Wl\,-E -Wl\,-B\,deferred ' cccdlflags='+z'\, lddlflags='-b -L/usr/local/lib'
Characteristics of this binary (from libperl): Built under hpux Compiled at May 27 1999 09:19:55 @INC: /home/medwards/perl/lib/5.00503/PA-RISC2.0 /home/medwards/perl/lib/5.00503 /home/medwards/perl/lib/site_perl/5.005/PA-RISC2.0 /home/medwards/perl/lib/site_perl/5.005 .
------_=_NextPart_001_01BF6F3E.9F8CBA1E Content-Type: text/plain; charset="iso-8859-1"
hello -
i have noticed that using different delimiters on regex calls will give different results. please run the following program to illustrate. the data file "temp.txt is also included. please note the difference between m//\, m##\, m^^ and the m?? - the question marks do not seem to work.
They certainly work\, and per the documentation. They just don't do what you think they do.
--tom
Tom Christiansen writes:
please note the difference between m//\, m##\, m^^ and the m?? - the question marks do not seem to work.
They certainly work\, and per the documentation. They just don't do what you think they do.
Which is a pity.
Ilya
Migrated from rt.perl.org#2103 (status was 'resolved')
Searchable as RT2103$