in reply to Opening Text Files
Here's a forehead-slapper: programming languages like Perl allow you to set variables ...
open FILE, $filename or die "Can't open $filename: $!\n";
So, get the name of the file into the script, perhaps by passing it as an argument on the command-line. Put the following near the top of the script to do this:
my $filename = shift @ARGV or die "Usage: $0 filename\n";
In fact, I often put filenames in scalars even for hard-coded filenames because if the name of the file ever changes, you only have to change it once.
|
|---|