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

[ID 20000204.007] problem using different delimiters on regex -d

Thread Next
February 4, 2000 20:23
[ID 20000204.007] problem using different delimiters on regex -d
Message ID:

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

> cat

$my_regex = q(.{20});

open (temp , "<test.txt");

my $i=0;
while (<temp>) {
        print "number $i\n"; $i++;

        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:
    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
    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/, 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

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About