The errors generated from running the code presented simply when adding use strict; use warnings;.I have some code on my home-node to automatically do that. It has nothing to do with any problems the OP has. Read this.
|Replies are listed 'Best First'.|
Re^7: difference between two files
by marto (Cardinal) on Dec 20, 2013 at 12:34 UTC
"I have some code on my home-node to automatically do that."
With respect, I didn't know about that until you told me. Do you think varalaxmibbnl knows this is here or how to use it? Do you believe this code you have on your homenode is better to give to those wishing to learn perl than the built in, cross platform features? This seems system specific (you use cat).
I clicked the download link, ran your code and got this:
I've downloaded thousands of code examples from this site and never hit this problem. hexdump -C foo.pl:
I have confirmed with others (here) that they experience the same problem. Once I've fixed each instance of $script I get the output from your program, run against the code provided by varalaxmibbnl:
Piping the output to a file and making said file executable results in:
Due to the shebang line is on line 5.
To summarise, currently there's an issue with downloading the code as provided on your homenode, the output from your suggested solution is (IMHO) not ideal.
"It has nothing to do with any problems the OP has"
I guess that depends on what you consider the "problems" to be. Trying things at random, copying and pasting code found online without knowing what it does (which can be a dangerous), then asking others to fix it when it doesn't do what they want? If you consider the goal to give advice which when starting out will be helpful, regardless of platform then I think my advice is sound. From a lot of experience here simply fixing or providing code on request more often than not results in subsequent posts of the same quality. I think it may be the exception where the users in question make some effort to learn from the code/explanation they've been given, we just end up with posts often emails from their employer/boss or exam/homework questions copied verbatim.
I don't agree that beginners should avoid using strict/warnings for the reasons mjd has illustrated in that document. They quite clearly have an advanced knowledge of the language and tools they are using. This is precisely what new users don't have. IMHO beginners need a gentle introduction strict/warnings more often than not give them the feedback they need to work out how to resolve their problems, or at least where to look and what questions to ask, which boosts confidence. Strict/warnings as with any tool, be it a soldering iron, 3D printer or a piece of software, the user need to spend time to learn what it does and how to use it.
Update: Added last sentence.