in reply to Pulling lines from a file into an array?

A nice idea would be an array of hashes, which is an alternative to the excellent two-array solution hardburn explained you.
use strict; open(QUESTIONS, '<', 'questions.txt') or die $!; open(ANSWERS, '<', 'answers.txt') or die $!; my @quiz; while(my $question = <QUESTIONS>) { my $answer = <ANSWERS>; chomp ($question); chomp ($answer); push @quiz, { 'q' => $question, 'a' => $answer, }; } close(QUESTIONS); close(ANSWERS); my $nquestions = scalar(@quiz);
You can then access to the elements as follows:
for my $i(0..$nquestions-1) { print $quiz[$i]{'q'}."\n"; print $quiz[$i]{'a'}."\n"; }
Michele.