Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

creamygoodness's scratchpad

by creamygoodness (Curate)
on Feb 08, 2006 at 18:55 UTC ( #528899=scratchpad: print w/replies, xml ) Need Help??

Invoking SvPVutf8 on $1 while in the midst of m//g seems to produce a nasty interaction.

use strict; use warnings; use Inline C => <<'END_C'; void test1(SV *sv) { STRLEN len; char *ptr = SvPVutf8(sv, len); warn("%s\n", ptr); } void test2(SV *sv) { STRLEN len; char *ptr = SvPVutf8(sv, len); warn("%s\n", ptr); SvPOK_off(sv); } END_C warn "SvPVutf8 messes up the behavior of \$1.\n"; my $foo = "a b c"; while ( $foo =~ /(\w)/g ) { warn "$1\n"; test1($1); } warn "Invoking SvPOK_off solves the problem.\n"; while ( $foo =~ /(\w)/g ) { warn "$1\n"; test2($1); }


marvin@smokie:~/perltest $ bleadperl SvPVutf8 messes up the behavior of $1. a a a a a a Invoking SvPOK_off solves the problem. a a b b c c marvin@smokie:~/perltest $
Log In?

What's my password?
Create A New User
[james28909]: ok maybe i need to ask this question in sopw and not CB but here goes
[james28909]: i am manually parsing html, and am trying to wrap my head around keeping up with tag counts

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-04-25 03:50 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (448 votes). Check out past polls.