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

[ID 20000727.005] if match problem

Thread Next
From:
Kevin
Date:
July 31, 2000 11:11
Subject:
[ID 20000727.005] if match problem
Message ID:
200007271928.PAA10552@ns1.sota-oh.com

This is a bug report for perl from s1kevin@sota-oh.com,
generated with the help of perlbug 1.13 running under perl 5.003.

[Please enter your report here]

#!/usr/bin/perl

$line="Suite 9";
if ( ~m/[A-Za-z]+,\s[A-Za-z][A-Za-z]\s\d\d\d\d\d(-\d\d\d\d)?$/, $line ) {
  print "Match on $line\n";
} else {
  print "No match on $line\n";
}

$line="Suite 9";
if ( $line=~m/[A-Za-z]+,\s[A-Za-z][A-Za-z]\s\d\d\d\d\d(-\d\d\d\d)?$/ ) {
  print "Match on $line\n";
} else {
  print "No match on $line\n";
}

$line="Coshocton, OH 43812-1214";
if ( $line=~m/[A-Za-z]+,\s[A-Za-z][A-Za-z]\s\d\d\d\d\d(-\d\d\d\d)?$/ ) {
  print "Match on $line\n";
} else {
  print "No match on $line\n";
}

The output of the above program is...

Match on Suite 9
No match on Suite 9
Match on Coshocton, OH 43812-1214

GRRRR.

m//, $var doesn't work reliably.
$var=~m// does.


Site configuration information for perl 5.003:

Configured by root at Thu Jun 27 21:47:52 PDT 1996.

Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
  Platform:
    osname=linux, osver=2.0.0, archname=i586-linux
    uname='linux darkstar 2.0.0 #1 mon jun 10 21:32:38 cdt 1996 i586 '
    hint=recommended, useposix=true, d_sigaction=define
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.7.2
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=4, usemymalloc=n, randbits=31
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc
    libc=/usr/lib/libc.so, so=so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'



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