regexp compilation

alythh_at_netscape.net
Date: 03/30/05


Date: 30 Mar 2005 02:50:07 -0800


hi all - I'm having some troubles, that seem related to regexp
compilation.

Trying to use the WordNet::SenseRelate module, I get a lot of errors
like the following:

Use of uninitialized value in regexp compilation at
/usr/lib/perl5/site_perl/5.6.1/WordNet/SenseRelate.pm line 1109, <SFH>
line 1.
...

the incriminated line is:
sub _loadStoplist
{
    my $self = shift;
    my $file = shift;
    open SFH, '<', $file or die "Cannot open stoplist $file: $!";
    $stoplist{$self} = [];
    while (my $line = <SFH>) {
        chomp $line;
        $line =~ m|/(.*)/|;
        push @{$stoplist{$self}}, qr/$1/; # <<<<< LINE1109
    }
    close SFH;
}

... so $1 comes from a previous pattern match on lines read from a file
at runtime.
I'm not at all an expert in quote-like operators, so I'm not able to
debug this problem - anybody can help ?

thanks1

Alessandro Magni



Relevant Pages

  • Re: Defining regexps and variables set by them
    ... Robert Klemme wrote: ... interpreter, without even bytecode compilation. ... regexp compiled once and stored in a variable or constant (assuming no interpolation is used or interpolation with "o" is used - otherwise both scenarios have different semantics anyway and can't be compared). ...
    (comp.lang.ruby)
  • Re: regexp compilation
    ... > hi all - I'm having some troubles, that seem related to regexp ... > Use of uninitialized value in regexp compilation at ... disregarding the regexp compilation. ...
    (comp.lang.perl.misc)
  • Re: Cacheing of regexps
    ... Does the RE need to be a literal constant string, ... or is it compared with the cached RE just before compilation? ... regexp $RE $other_text match2 ... So, no the RE isn't compiled twice, (not sure if it would be compiled ...
    (comp.lang.tcl)
  • Re: string search on grep
    ... I have try awk, but it seems there are some troubles on ... regexp for me. ... is invalid syntax for grep. ...
    (comp.unix.shell)