<rant>
I really hate the stupid suggestions of adding 'strict' and 'warnings' if they do not solve the problem presented.
Problems should be presented with as minimal code as necessary to show the problem. The OP did that. Slapping the three lines you suggested on to it would just make the code larger, drawing away the attention from the problem. Don't scold at the OP for doing the right thing.
And would have gained nothing - except to stop mindless responses like yours.
Yeah, yeah, someone will say, but it's good advice anyway. Sure it is. And so are the other 255 points from Damians newest book. Should we post a list of 256 good advices on every problem posted here?
</rant> | [reply] |
I said it because he seemed like a newbie and I thought he could use the advice. Also he probably could have figured it out on his own if he had used strict et al.
Also why rant anonomyously? Be proud of your rants, take credit for them.
| [reply] [d/l] |
Also he probably could have figured it out on his own if he had used strict et al.
No. That's the point of my rant. You didn't even bother to try, did you?
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
my @Line;
COPY:
use File::Copy;
copy("$Line[0]","$Line[1]") or die "Copy failed: $!";
__END__
syntax error at f line 10, near "use File::Copy"
Execution of f aborted due to compilation errors (#1)
(F) Probably means you had a syntax error. Common reasons include
+:
A keyword is misspelled.
A semicolon is missing.
A comma is missing.
An opening or closing parenthesis is missing.
An opening or closing brace is missing.
A closing quote is missing.
Often there will be another error message associated with the synt
+ax
error giving more information. (Sometimes it helps to turn on -w.
+)
The error message itself often tells you where it was in the line
+when
it decided to give up. Sometimes the actual error is several toke
+ns
before this, because Perl is good at understanding random input.
Occasionally the line number may be misleading, and once in a blue
+ moon
the only way to figure out what's triggering the error is to call
perl -c repeatedly, chopping away half the program each time to se
+e
if the error went away. Sort of the cybernetic version of S<20
questions>.
Uncaught exception from user code:
syntax error at f line 10, near "use File::Copy"
Execution of f aborted due to compilation errors.
at f line 13
strict, warnings and diagnostics turned on. And it didn't tell anything the OP didn't know of.
I thought he could use the advice.
But there are a million more advices to give - each of them having as much relevance to the OP's problem as the advice you gave. You omitted those.
Also why rant anonomyously? Be proud of your rants, take credit for them.
Oh, I am. And don't get the impression you aren't as anonymous as I am. Or do you really think that your description of "Super Genius & XPW" and the image of the monster Frankenstein created you put on your user page identify who you are? Or perhaps it's the "Brother Crossbow of Engaged Distraction" that makes you stand out from the other nerds? | [reply] [d/l] |