http://www.perlmonks.org?node_id=166003


in reply to Oops I did it again.....

This looks like a great learning experience. So what if there's another way to achieve the same thing? (...as you noted.)
My comments, for what they're worth:

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'.
Then again, you might not. 'use vars' is more compatible. So many Ways To Do It!

You store ARGV[0] 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.
Maybe set $read to 'T' when declared (i.e. our $read='T') and only change it to 'C' on user request.

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.
s!!password!;y?sordid?binger?; y.paw.mrk.;;print chr 0x5b ;;; print;print chr(0x5b+0x2);;;;;

Replies are listed 'Best First'.
Re: Re: Oops I did it again.....
by Anonymous Monk on May 12, 2002 at 19:53 UTC
Re: Re: Oops I did it again.....
by defyance (Curate) on May 13, 2002 at 02:02 UTC
    Great suggestions!! ++ to mrbbking This was a simple hack that I posted here for suggestions, and I can't thank you enough for yours. I'll wait on some more and put it all together, and post it at the end..

    -- Yes, I am a criminal. My crime is that of defyance.