P is for Practical | |
PerlMonks |
Re: Commifying sensiblyby Limbic~Region (Chancellor) |
on Dec 01, 2008 at 15:47 UTC ( [id://727120]=note: print w/replies, xml ) | Need Help?? |
oko1,
Recently, I was thinking about that example in the docs where they demonstrate a method for inserting commas into a numerical string. You mean the one from perlfaq5? but that thing is just clumsy and awful and obfuscated for any Perl beginner. So, just for my own entertainment, I decided to see how I'd do it "for real" - i.e., in the best way possible rather than by this contrived method.I agree that many of the solutions in the FAQ are written more as a cook book rather than as a tutorial. On the other hand, do you honestly feel that your solutions are any better if your target audience is a perl beginner? If that is your target audience, I would have gone with something a bit more verbose.
Since it seems your intended goal was to educate beginners, each step should be preceded by the appropriate amount of comments. It may not be obvious what a regex is doing so you could recommend YAPE::Regex::Explain. They may not have considered edge cases, so rather than incorporate them into a single step that is doing something else - break it out on its own statement. Cheers - L~R
In Section
Cool Uses for Perl
|
|