more useful options | |
PerlMonks |
Re: More efficient use of HTML::TokeParser::Simpleby liverpole (Monsignor) |
on Jul 10, 2006 at 20:05 UTC ( [id://560210]=note: print w/replies, xml ) | Need Help?? |
Hi henka,
I hadn't used HTML::TokeParser::Simple before, but I just tried it now, and it works fine for me even after removing the second call:
So it seems logical that you would only instantiate the object once at the beginning. (Update: Whoops ... not necessarily the case, as several wiser monks have gently instructed below.) A couple of points I'd mention, though. First, if you add:
at the beginning of your code, you'll see that you've redefined $p. (The strict and warnings pragmas are considered good programming practice, as they will catch a lot of things that might otherwise cause you problems -- it's a good idea to use them in all your programs). Secondly, it might be more helpful to the user (or even yourself!) if you give an error message or a syntax message in case no argument are passed to the program. For example:
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
In Section
Seekers of Perl Wisdom
|
|