l.frankline has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I am working with a text file, it contains xml tags consisting of huge lines.
what i have done in the code is...I find opening tag "<bul-list>" and keep counting it in a variable $bullopen and closing "</bul-list>" in a variable $bullclose
This code is working fine but, but I need a better code than this... I mean it in a shortest code. Can any help me.
$bullopen = 0; $bullclose = 0; while ($_=~s#<bul-list>##) { $bullopen++; } while ($_=~s#</bul-list>##) { $bullclose++; } print $bullopen; print $bullclose;
jpodrter fixed code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Any other options for total count
by Samy_rio (Vicar) on Nov 16, 2005 at 12:34 UTC | |
|
Re: Any other options for total count
by dorward (Curate) on Nov 16, 2005 at 12:36 UTC | |
|
Re: Any other options for total count
by Perl Mouse (Chaplain) on Nov 16, 2005 at 13:23 UTC |