in reply to Re: Angle brackets and regex problem
in thread Angle brackets and regex problem

It's official! I'm blind! :(

I expected it not to find a match. Oh, dear! So embarrassing!

Replies are listed 'Best First'.
Re^3: Angle brackets and regex problem
by ikegami (Patriarch) on Jan 05, 2007 at 17:40 UTC

    If you ever wonder what something matched, you can use

    my $at = $-[0]; my $matched = substr($test, $at, $+[0]-$at); warn(Matched "$matched" at $at\n");

    Alternatively, you could pass the argument -Meval=debug to perl. (e.g. perl -Mre=debug script.pl). It produces a detailed (i.e. long) report of all regexp activities.

    References:

    • @- and @+ are documented in perlvar.
    • -Mre=debug adds use re 'debug'; to your program. See re.