|Perl Monk, Perl Meditation|
Re: Suggestion for regular expression speed improvement.by QM (Parson)
|on Jun 15, 2009 at 17:37 UTC||Need Help??|
To put a finer point on the previous responses...
I see you've just joined Perlmonks, and this seems to be your first post. Given that, everyone will cut you some slack, to a point.
Regarding Text::CSV_XS (emphasis mine):
The module accepts either strings or files as input and can utilize any user-specified characters as delimiters, separators, and escapes so it is perhaps better called ASV (anything separated values) rather than just CSV.
So I would respectfully suggest that you haven't considered the degree of the generic solution provided by T::C. I'd suggest rereading the module doc several times, and trying a few toy examples to give you the flavor of it's capabilities, and whether any drawbacks it holds are acceptable for you.
For myself, I use it in a few scripts, and it is amazingly fast, and yet very configurable. Googling for reviews finds lots of similar opinions.
Otherwise, I'd go with the coderef idea. Give your users a few examples based on log files you've encountered, just to be helpful. But there are a lot of pitfalls here, not even considering malevolent code.
BTW, come back here often, and read up on anything that catches your fancy. This is the best place I know to get your Perl questions answered. You'll learn a lot by reading, and more by asking questions. Good luck.