Hi,
What is this current error telling me?Usage: ./exer_9_2 filename at ./exer_9_2 line 7.
You're obviously serious about learning to program, so you'll want to start more becoming pedantic right away :-)
That's not an error, that's a message. The error was when you pressed [Enter] after only typing "./exer_9_2".
The message is being emitted by the die command on line 7. The message tells you that fact, with its last part "at ./exer_9_2 line 7" showing filename and line. Perl is just that awesome.
The first part of the message is whatever the die command caused to be emitted. In this case, it's the value of the expression Usage: $0 filename. Hopefully you know (since you put it in your code) that $0 resolves to the current filename. So that's why the message names the file twice.
Knowing all that, you might decide to produce cleaner output, and not die, but just exit instead.
(Note the use of the convention of placing an example value for an argument inside angle braces.)if (! defined $in) { print "Usage: $0 <filename>\n"; exit(1); }
Hope this helps!
In reply to Re^2: First attempt at bringing in file for input/output
by 1nickt
in thread First attempt at bringing in file for input/output
by catfish1116
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |