OK, I sat back down on this one and figured it out:

#!/usr/bin/perl -w use strict; ########################## # # # Coded by Scott J Ulmen # # # ########################## my $source; my $dest; ($source, $dest) = @ARGV; my $new = "$dest".'/'."$source"; if (-d $dest) { rename $source, $new; } elsif (-e $dest) { print "Sorry, $dest already exists in this dir!\n"; } else { rename $source, $dest; }

Granted, I should add a regex to determine if the dir that I type in has a trailing "/", but it gets the job done an an exercise for the idea being presented WITHOUT A MODULE.

I have to admit that I was a bit upset that I couldn't get pointed in the right direction, but I'm glad now that nobody posted an answer as it mad me sit down today to figure it out. (I can be stubborn at times) :)

Apparently, my problem was simply with the ORDER of the else's. Man did that drive me crazy! To the point that I tried to rewrite it at least 4 different ways before coming back to my 1st try.


In reply to Re: Llama book appendix A ch12 - how in the world? by zerogeek
in thread Llama book appendix A ch12 - how in the world? by zerogeek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.