#!/usr/local/bin/perl -w use Getopt::Long; # Set up the command line to accept a filename. my $ret = GetOptions ("f|filename:s"); my $filename = $opt_f || die "Usage: $0 -f filename\n"; # Check if the file exists if (-e $filename) { print "The file $filename exists.\n"; } else { print "The file $filename does not exist.\n"; }