Tu dois utiliser une boucle et un array.



my @nombres;
chomp(my $x = <STDIN>);
for (1..$x) {
push @nombres, <STDIN>;
}