in reply to Re^2: Create reference to sorted anonymous array
in thread Create reference to sorted anonymous array

As choroba and others have mentioned, I actually seldom use $_ and give an actual name to the var. This doesn't slow the code down a bit and makes it more readable.

foreach my $line (@$array_ref) { print $line; }
is just fine !!

I write and lot of C code (and also ASM). I can tell you that the very, very most common error in programming is the "off by one" error. The  foreach() syntax avoids that possibility. There are a lot of programs out there that sometimes break in mysterious ways due to memory allocation errors and other issues related to the "off by one" problem. the foreach() syntax avoids this problem.

You early instruction will serve you well. There is just a different way to do it in Perl than in C.