while ( @ar ) { push @result, pop(@ar), shift(@ar), shift(@ar), pop(@ar); }