Apart from the other comments (it's zero-is-false syndrome), I'll add that you should really be using IO::File, rather than FileHandle, as it's the "newer" version of OO files.
Also, and perhaps more significantly (depending on what your aim is - learning or doing it for serious work), you have a long way to go before this is "right". Currently the only parser in Perl getting anywhere near compliance to the XML spec is my XML::SAX::PurePerl, and I'm so not finished it's not even funny. At the moment PurePerl has about 3000 lines of code (and very few docs or comments), and I've got shit loads of stuff left to implement (at the moment it's careful enough to skip over stuff I haven't implemented yet).
Don't let me discourage you though - it can be fun writing hand crafted parsers, but with XML you really do have to know the spec inside out.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.