use strict; use warnings; use feature 'state'; use Test::More tests => 1; my $in = 'A |simple*example| is |so*simple| to come*up |with these*days|'; my $want = 'A |simple-example| is |so-simple| to come*up |with these-days|'; my $have = join '|', map { state $i = 0; $i++ % 2 and s/\*/-/g; $_ } split /\|/, $in, -1; is $have, $want;