in reply to perl one liner to print a line

The array approach would be
perl -e'@x=<>; print $x[3]'

but that loads the entire file into memory where the $. method doesn't. Just putting it out there since you tried to use an array.

Replies are listed 'Best First'.
Re^2: perl one liner to print a line
by sugar (Beadle) on Dec 12, 2008 at 02:03 UTC
    yea... i dont want to take the whole file into memory. so $. is a better way for me :)
Re^2: perl one liner to print a line
by jwkrahn (Abbot) on Dec 12, 2008 at 07:11 UTC

    Or:

    perl -F'\n' -lan0777e'print $F[3]' file.txt