Index an array
#!/usr/bin/perl use warnings; use strict; my @questions = qw(Java Python Perl C); my @punchlines = ("A","B","C",'D'); for (0..$#questions) { print "How many $questions[$_] "; sleep 2; print $punchlines[$_], "\n\n"; sleep 1; }