# Interleaved order while ( /($a|$d)/g ) { print "$1\n"; } #### # Original order. Note that $1 is now $_. for ( /($a)/g, /($d)/g ) { print "$_\n"; }