You most likely do not want to use a hash (associative array is not a perl construct any longer) at all. What you are describing is using an array. Hashes are used for storing data connected with unique keys, arrays for serial data.
open my $fh, "<", $inputfile or die $!;
my @array = <$fh>;
print @array; # will preserve the order of the lines from the file
Of course, if you want the data sorted, you can do that with print sort @array.
Now, if that had been done with a hash, you'd do something like:
my %hash = map { $_ => 1 } <$fh>;
print sort keys %hash; # will not preserve order
And as you can see, the end result is only that you do not preserve the original order of the file, but instead have to sort it, or get a semi-random order. All the while, you're running the risk of overwriting keys, if you have identical lines. This is good for de-duping data, but not for true representation of file content.
You might think "But hey, what if I use another kind of key and store the line as the value?" Well, sure, you might take JRFerguson's advice and use a numerical index. But then you are using an array, just forsaking the natural benefits of using a proper array. You do not actually gain anything by doing this, only lose things.