Let me begin by saying that I have been reading through the llama book and gaining vast amounts of knowledge. The book seems so logically laid out and I have had all my questions answered. Granted, some of the exercises have caused me quite a bit of thinking, but that is all part of the learning process and I accept that.

However...
While trying to come up with a solution to q5 in ch12 (I am using the 4th ed), I was stumped trying to make the 2nd half work.
That full question reads,
"Write a program that works like mv, renaming the first command-line argument to the second command-line argument. (You don't need to handle any of the options of mv or additional arguments.) Allow for the destination to be a directory; if it is, use the same original basename in the new directory."

The 1st part was easy using rename, but I struggled with the 2nd half allowing for the directory. So, I checked the appendix for some guidance and find that the authors used File::Basename and File::Spec to solve this as well as questions 6,7, and 8.

Am I the only one that has read this book and become confused by the use of modules in a solution 3 chapters before they are introduced for the 1st time???

Please forgive the rant (it's 0430 and I'm getting tired). I'll try this again in the morning WITHOUT the use of the modules. I guess I was just surprised at this particular solution being offered by the book.


In reply to 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.