News for hackers. Stuff that matters.
Re:10 tips for writing perl one-liners by wazoox on Thursday May 27, 2010 @05:07PM (#1384953)
It's definitely better than shell for quick file processing :) Check out this fantastic cut replacement (thanks to mjd):

  #!/usr/bin/perl
  
  my $field = shift or usage();
  $field -= 1 if $field > 0;
  
  while (<>) {
      chomp;
      my @f = split;
      print $f[$field], "\n";
  }
  
  sub usage {
      print STDERR "$0 fieldnumber\n";
      exit 1;
  }

There are no comments on this comment yet.