in reply to Question on s///eg
$bitmap =~ s{ (1 (?: ,1 )* ) # match 1 or 1,1 or 1,1,1,... | ,? (0 (?: ,0 )* ) # match 0 or 0,0 or 0,0,0,... }{ # evil tr/// bug with $<DIGITS> my ($one, $zero) = ($1, $2); ++$i; if ($zero) { $i += $zero =~ tr/,//; ""; } else { if (my $c = $one =~ tr/,//) { "$i-" . ($i += $c) } else { $i } } }xge;
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker, who'd like a (from-home) job
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;
|
|---|