Front page | perl.perl5.porters |
Postings from October 2003
[perl #24217] regex: ([^\s]+) leaves $1 empty (read from filehandle), Perl 5.8.0
Thread Next
From:
Paolo Campanella
Date:
October 18, 2003 15:27
Subject:
[perl #24217] regex: ([^\s]+) leaves $1 empty (read from filehandle), Perl 5.8.0
Message ID:
rt-24217-66067.12.3869764942624@rt.perl.org
# New Ticket Created by Paolo Campanella
# Please include the string: [perl #24217]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24217 >
([^\s]+) matches, but does not make available the match via $1 etc or
$&, iff read from a filehandle. Substituting ([^\S]+) works. Also
verified that this worked find in Perl 5.6.1.
Example:
#!/usr/bin/perl
use strict;
my $input_string = "left = right";
my $conf_file = "regex.conf";
open (CONF,">$conf_file") || die "Could not open conf file: $!\n";
print CONF $input_string;
close CONF;
open (CONF2,"$conf_file") || die "Could not open conf file: $!\n";
while (<CONF2>) {
if (/\s*([^\s]+)\s*=\s*(.+)/) {
print 'match via filehandle: '."$1 - $2\n";
}
}
close CONF2;
if ($input_string =~ /\s*([^\s]+)\s*=\s*(.+)/) {
print 'match via input string: '."$1 - $2\n";
}
Output is:
match via filehandle: - right
match via input string: left - right
[paolo@paololt perl]$ perlbug -d
---
Flags:
category=
severity=
---
Site configuration information for perl v5.8.0:
Configured by bhcompile'
cf_email='bhcompile at Wed Aug 13 11:45:59 EDT 2003.
Summary of my rderl (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.21-1.1931.2.382.entsmp,
archname=i386-linux-thread-multi
uname='linux str'
config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686
-Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red
Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux
-Dvendorprefix=/usr -Dsiteprefix=/usr
-Dotherlibdirs=/usr/lib/perl5/5.8.0 -Duseshrplib -Dusethreads
-Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db
-Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio
-Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less
-isr'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef'
useithreads=define usemultiplicity=
useperlio= d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=un uselongdouble=
usemymalloc=, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-DDEBUGGING -fno-strict-aliasing -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING
-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)',
gccosandvers=''
gccversion='3.2.2 200302'
intsize=r, longsize=r, ptrsize=5, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long'
k', ivsize=4'
ivtype='l, nvtype='double'
o_nonbl', nvsize=, Off_t='', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc'
l', ldflags =' -L/u'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=
libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libper
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so', d_dlsymun=undef, ccdlflags='-rdynamic
-Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC'
ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5', lddlflags='s
Unicode/Normalize
XS/A'
Locally applied patches:
MAINT18379
---
@INC for perl v5.8.0:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
.
---
Environment for perl v5.8.0:
HOME=/home/paolo
LANG=en_ZA.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/paolo/bin
PERL_BADLANG (unset)
SHELL=/bin/bash
dlflags='-share (unset)
[paolo@paololt perl]$
Thread Next
-
[perl #24217] regex: ([^\s]+) leaves $1 empty (read from filehandle), Perl 5.8.0
by Paolo Campanella