|Perl Monk, Perl Meditation|
Re: Oops I did it again.....by mrbbking (Hermit)
|on May 12, 2002 at 17:06 UTC||Need Help??|
This looks like a great learning experience.
So what if there's another way to achieve the same thing? (...as you noted.)
You never use $dest, after declaring it with use vars.
If you're using Perl 5.6+, you might want to use 'our',
instead of 'use vars'. With Perl 5.6, 'our' obsoleted 'use vars'.
You store ARGV in $temp twice. (Did you mean == in the if statement?)
Your 'confirmation' questions are wordy, and there is no default.
Convention is to make the less destructive option the default.
You check the 'mv' system call for success, but you don't check the 'rm' call
You have an 'err' sub, but that sub does not call exit. So, even if something goes wrong, your program exits with '0', indicating success.
Suggestion: Wait for more suggestions from others. Once you've got a few, pick the ones that make sense to you, and re-write it. Save a copy of what you have now so that you can compare them.Update: Fixed formatting. Also, ++ to Anonymonk for the our pointer.