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

@+ and @- do not interpolate

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
February 5, 2000 16:13
Subject:
@+ and @- do not interpolate
Message ID:
9118.949796026@chthon
Run this with pl64:

    $_ = "silly bits are matched muchly here";

    $count = 0;
    while (/(\w+)\s+(\w+)/g) {
	$count++;
	print "\nMatch #$count for m/(\\w+)\\s+(\\w+)/g in `$_'\n";
	print "\$1 is `$1', \$2 is `$2'; \@- is [@-] and \@+ is [@+]\n";
	print "\$1 is `$1', \$2 is `$2'; \@- is [",
	    join(" ", @-), "] and \@+ is [", join(" ", @+), "]\n";
    } 

And you get this:

    Match #1 for m/(\w+)\s+(\w+)/g in `silly bits are matched muchly here'
    $1 is `silly', $2 is `bits'; @- is [@-] and @+ is [@+]
    $1 is `silly', $2 is `bits'; @- is [0 0 6] and @+ is [10 5 10]

    Match #2 for m/(\w+)\s+(\w+)/g in `silly bits are matched muchly here'
    $1 is `are', $2 is `matched'; @- is [@-] and @+ is [@+]
    $1 is `are', $2 is `matched'; @- is [11 11 15] and @+ is [22 14 22]

    Match #3 for m/(\w+)\s+(\w+)/g in `silly bits are matched muchly here'
    $1 is `muchly', $2 is `here'; @- is [@-] and @+ is [@+]
    $1 is `muchly', $2 is `here'; @- is [23 23 30] and @+ is [34 29 34]

Oh, drat!

--tom

Thread Previous | Thread Next


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