use strict; use warnings; my @foo = (); while (){ chomp; if ($. < 4){push @foo, $_}} print "my first variable is $foo[0]"; print "my second variable is $foo[1]"; print "my third variable is $foo[2]"; __DATA__ one two a beautiful tree, maybe an oak?