Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: help please
by demerphq (Chancellor) on Mar 25, 2002 at 14:46 UTC | |
Ok its a little tongue in cheek, but I think you get the idea... ;-) Good luck! And dont forget to use strict and warnings, to have a read through perlfunc, and perhaps perlopentut Yves / DeMerphq--- Writing a good benchmark isnt as easy as it might look. | [reply] |
by IlyaM (Parson) on Mar 25, 2002 at 22:55 UTC | |
Perhaps the rename keyword would be useful, consult perlfunc. It is better to use move from File::Copy. It is guaranteed to work across filesystem boundaries.
-- | [reply] [d/l] |
Re: help please
by ropey (Hermit) on Mar 25, 2002 at 14:29 UTC | |
Most importantly don't get yourself into a panic just do take one small step at a time. HTH | [reply] [d/l] |
by sdyates (Scribe) on Mar 25, 2002 at 19:37 UTC | |
I hope young grasshoper reads your post--it is essential to any programming or scripting: valuable life skill!!!! Very good post | [reply] |
(jeffa) Re: help please
by jeffa (Bishop) on Mar 25, 2002 at 14:57 UTC | |
Now, for everyone else - i am the only one that got a little disturbed by this requirement? C) any html tags within html files are to be converted to upper case I took me 3 years to convince myself that lower case was better ...Check out this little snippet from http://www.w3schools.com/html/html_elements.asp: If you want to prepare yourself for the next generations of HTML you should start using lowercase tags. The World Wide Web Consortium (W3C) recommends lowercase tags in their HTML 4 recommendation, and XHTML (the next generation HTML) demands lowercase tags. Don't tell your instructor i said this though ... they might agree with you and substitute a harder requirement. ;) (although lowercasing the tags would be better) jeffa L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat) | [reply] |
Re: help please
by Snuggle (Friar) on Mar 25, 2002 at 14:17 UTC | |
Also, when including code, please use the code html tags and other tips found in Writeup Formatting tips Anyway, no drug, not even alcohol, causes the fundamental ills of society. If we're looking for the source of our troubles, we shouldn't test people for drugs, we should test them for stupidity, ignorance, greed and love of power. --P. J. O'Rourke | [reply] |
Re: help please
by thunders (Priest) on Mar 25, 2002 at 17:19 UTC | |
| [reply] |
Re: help please
by sdyates (Scribe) on Mar 25, 2002 at 19:34 UTC | |
An excellent tool for getting started with perl is: Perl for Dummies--They spell everything out in this book. Did you try searching this site on commands such as dir(). Many people have snippets of code where they read directories. Also use google to search on specific perl commands. They are many examples out there. Once you have a good idea, come on back and ask a more specific question. We want to help, but want to know that you really are trying to understand the language: you task is not a difficult one. | [reply] |
by Marza (Vicar) on Mar 25, 2002 at 20:31 UTC | |
An even better book. Beginning Perl by Simon Cozens It covers many areas and will give you a decent feel for perl. | [reply] |
Re: help please
by MAXOMENOS (Scribe) on Mar 26, 2002 at 03:23 UTC | |
Once again, I won't do your homework for you. However, you'll probably do well to consult the following books to figure out how to get the job done: I would not recommend Programming Perl if all you're trying to do is get things done, fast. With these three books, and a little bit of programming background, you can probably figure out how to get this done in a few days. I definitely do not recommend putting this off until the last minute. It's much easier to solve problems when one has more time and is more releaxed. I would recommend running your script against some very short tests just to make sure that all the individual requirements get done. Finally, good luck, and don't do this again. | [reply] |
Re: help please
by Revelation (Deacon) on Mar 26, 2002 at 01:58 UTC | |
Also: Instead of -d $dirname, it may be simpler to just die, if the directory can't be opened? opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!"; Or you can write a function to nicely die, and output the reason for it to the user. Just remember to exit;, with that function. so: instead of You Could Use:
And you'd have a list of everything in the directory, without . and .., and with diff arrays for directories and files. In fact, since you're only editing certain types of files, you could change the first grep to suit your needs, with a regex, or you could add a few greps for the differant types of files, which would let you change shtml files to html files rather easily. If you want to have only two greps, then use && regex. It's also my opinion that your teacher will not be very happy if you use a ton of perl modules, as the point of this excersize seems to be to test your knowledge of perl, not the writer of a perl modules' knowledge. Using a perl module is like using somebody else code, which is alright in the GNU/perl world, but is not alright in school. I would advise hard coding much of it, and adding comments to show your teacher that you know perl modules. Gyan Kapur gyan.kapur@rhhllp.com | [reply] [d/l] [select] |