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

[ID 20000307.006] $1, $2 and the '..' operator

Thread Previous
From:
Aaron Harsh
Date:
March 7, 2000 11:33
Subject:
[ID 20000307.006] $1, $2 and the '..' operator
Message ID:
200003071932.LAA01019@doughboy.formovies.com
This is a bug report for perl from ajh@doughboy.rtk.com,
generated with the help of perlbug 1.26 running under perl 5.00502.


-----------------------------------------------------------------
[Please enter your report here]

It looks like $<digit> vars don't appear to interact cleanly
with the '..' operator.  For example, this script:

    #!/usr/bin/perl -w

    use strict;

    my $foo = "A-C";
    if ($foo =~ s/^(\w+)-(\w+)//) {
        print join(",", $1 .. $2), "\n";
    }

    my $bar = "A-C";
    if ($bar =~ s/^(\w+)-(\w+)//) {
        my $baz = $1 . $2;
        print join(",", $1 .. $2), "\n";
    }

gives this output on my system:

    Argument "A" isn't numeric in flop at ./bug.pl line 6.
    Argument "C" isn't numeric in flop at ./bug.pl line 6.
    Argument "A" isn't numeric in flop at ./bug.pl line 6.
    Argument "C" isn't numeric in flop at ./bug.pl line 6.
    0
    A,B,C

Note that the script gives the expected results on line 13.


[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00502:

Configured by ajh at Sat Oct 17 22:33:23 PDT 1998.

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
  Platform:
    osname=linux, osvers=2.0.34, archname=i686-linux-thread
    uname='linux doughboy.rtk.com 2.0.34 #7 sat oct 17 19:11:23 pdt 1998 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.7.2.3
    cppflags='-D_REENTRANT -Dbool=char -DHAS_BOOL'
    ccflags ='-D_REENTRANT -Dbool=char -DHAS_BOOL'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.00502:
    /usr/lib/perl5/5.00502/i686-linux-thread
    /usr/lib/perl5/5.00502
    /usr/lib/perl5/site_perl/5.005/i686-linux-thread
    /usr/lib/perl5/site_perl/5.005
    .

---
Environment for perl 5.00502:
    HOME=/dp/usr/ajh
    LANG (unset)
    LD_LIBRARY_PATH=/usr/lib:/oracle/orahome/lib
    LOGDIR (unset)
    PATH=/sbin:/usr/sbin:/opt/kde/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/ajh/SmallEiffel/bin:/oracle/orahome/bin
    PERL_BADLANG (unset)
    SHELL=/bin/tcsh

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About