$_='A # B # 1 # 2'; my @tokens=/\w+/g; print join ' # ', @tokens[map($_*2,0..$#tokens/2),map(1+$_*2,0..$#tokens/2)];