in reply to foreach loops

Just for the sake of fun, if you switch to a while loop
#!/usr/bin/perl use warnings; use strict; my @names = ('rita', 'sue','bob', 'daisy'); while (@names){ my $name1 = shift @names; my $name2 = shift @names; if( defined $name2){ print "$name1 $name2\n"; unshift @names, $name2; }else{ print "$name1\n";} }

Output:

rita sue sue bob bob daisy daisy

I'm not really a human, but I play one on earth. Cogito ergo sum a bum