[Perl] Re: Regexp help

Gaal Yahas gaal at forum2.org
Sat Jan 5 06:38:03 PST 2002


On Sat, Jan 05, 2002 at 04:06:28PM +0200, nothingmuch wrote:
> i have a regexp for a turing machine utility:
> 
> $sooey =~ s/([01_\@\#\$\%\&a-zA-Z])/$i,_,++$i,$1,>\n/g;
> 
> i want ++$i to actually *BE* ++$i (i mean $i increased by one, and 
> returned)

Use the /e modifier:

$sooey =~ s/([01_\@\#\$\%\&a-zA-Z])/"$i,_," . ++$i . ",$1,>\n/eg;

-- 
Gaal Yahas <gaal at forum2.org>
http://www.forum2.org/gaal/
http://www.livejournal.com/~gaal/



More information about the Perl mailing list