http://www.perlmonks.org?node_id=120753


in reply to What is the simplest way to print a field, as in $3 does in awk

Use the -a switch to autosplit to @F.
perl -lane 'print if $F[1] =~ /localhost/' /etc/hosts
or     perl -lne 'print if /localhost/' /etc/hosts --
John.