#!/usr/bin/perl use strict; use warnings; while ( <> ) { # takes filenames on the command line or STDIN if none print ( ( split )[1] ); }