#!/usr/local/bin/perl -w use Getopt::Long; my $ret = GetOptions ("f|filename:s"); my $filename = $opt_f || die "Usage: $0 -f filename\n"; # Open the file. open (INPUT, "$filename") || die "Could not open file $filename : $!\n"; while (<INPUT>) { chop; print "Line $. = <$_>\n"; } close (INPUT);