in reply to RegEx, $1, problem

This should work better:
next unless $string =~ /<b>(\w|\.+\.zip)<\/b>/; &do_something_with($1);
You have to have a successful match to have a $1.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


update: Ahh, I thought your problem was in not having a $1 after a failed match, but you've later determined it was your regex. My advice applies, just to a different problem. {grin}

Replies are listed 'Best First'.
Re^2: RegEx, $1, problem
by ikegami (Patriarch) on Oct 28, 2004 at 14:56 UTC
    Isn't that the same as as the OP? You negated the if to unless AND the =~ to !~ for a net change of nothing.
Re^2: RegEx, $1, problem
by Anonymous Monk on Oct 28, 2004 at 14:54 UTC
    Same problem. If i remove the paren's it matches fine. If i add them back in nothing gets matched. I removed the "&do_something_with($1);" and replaced it with:
    print "got here.\n";
    for the sake of testing. those parens seem to be screwing it up.

    Perl version is 5.8.1-RC3 (comes with macosx)