Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Parse tags into an array

by blue_cowdawg (Monsignor)
on Jan 15, 2013 at 16:08 UTC ( #1013420=note: print w/ replies, xml ) Need Help??


in reply to Parse tags into an array

      Could please point out any approach that would be the best to achieve this ?

What have you tried? What was the result?

The approach I'd take would be to create a pseudo state machine that changes state based on input. If I was able to attach graphics to a PM post I'd give you a nice state diagram for that, but here goes with a text only version

        +------------------------------------+
        |                                   yes
        v                                    |
     start----->"TAGSTART" ---> intag ---> "TAGEND?" <------+
                                             |              |
                                           process input ---+

The bit "process input" you essentially read in a line, depending on the tag you just add it to a hash as appropriate.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg


Comment on Re: Parse tags into an array

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013420]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2015-07-04 17:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls