zerogeek has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Llama book appendix A ch12 - how in the world?
by blazar (Canon) on May 12, 2006 at 12:27 UTC | |
Re: Llama book appendix A ch12 - how in the world?
by merlyn (Sage) on May 12, 2006 at 16:33 UTC | |
Re: Llama book appendix A ch12 - how in the world?
by kwaping (Priest) on May 12, 2006 at 15:12 UTC | |
Re: Llama book appendix A ch12 - how in the world?
by zerogeek (Monk) on May 15, 2006 at 23:17 UTC |