http://qs321.pair.com?node_id=11133062


in reply to Regexp substitution on variable-length ranges with embedded code?

$seq =~ s/ (\d+):(\d+):(\d+) (?:;|\s)* (\1):(\2):(?{1+($3|$6)}) /$1:$2:$3-$6/xg;

FWIW, the (?{1+($3|$6)}) expression | embedded code expression in the quoted regex just adds 1 to the bitwise-or of $3 and $6 (treated as numbers... I think) and then throws away the result; it's a no-op.


Give a man a fish:  <%-{-{-{-<