my $file1 = "foo.txt"; my $file2 = "bar.txt"; my @array1 = ($file1, $file2); # or my @array2; print "Enter a file: "; while (<>) { chomp; push @array2, $_; print "Enter a file: "; }