http://www.perlmonks.org?node_id=528905


in reply to Re^2: Balance Change
in thread Balance Change

Thanks for the help everyone, I've also found you can write it like this as well:

while ( <code goes here> ) {}

The important but being that there's nothing in the {}. This gives us the original one-liner broken up to this:

#!/usr/bin/perl my $string = 'abc abc abc \textit{abc abc} abc \textit{abc abc \textbf +{abc \textbf{abc abc} abc} abc} abc.'; while ($string =~ s/\\text(i|b)[tf]\{([^{}]*)\}/<$1>$2<\/$1>/g) {} print $string;

Or you could take out the {} and add a 0, X, or whatever in front of the while (...)