Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: insert data into data structure

by Ea (Chaplain)
on Nov 30, 2015 at 11:15 UTC ( [id://1148883]=note: print w/replies, xml ) Need Help??


in reply to Re^2: insert data into data structure
in thread insert data into data structure

This if($line =~ /^\.+\$/) probably doesn't do what you want. To my eyes, it only matches a line that begins .+$, but backslash $ doesn't seem to do anything other than mess up the match. You might try the Regular Expression test page. If that first line doesn't match, you never get anything in @listSection, so there's nothing to Dump.

Sometimes I can think of 6 impossible LDAP attributes before breakfast.

http://act.yapc.eu/lpw2015/ It's that time of year again!

Replies are listed 'Best First'.
Re^4: insert data into data structure
by Genmai (Initiate) on Nov 30, 2015 at 12:47 UTC
    sorry, i wrote it fast, the right regex is  ($line =~ /^\[.+\]$/) i didn't put the tag of code.

      Your example data doesn't show the square brackets. Can you give a better example of what your data looks like?

      Based on your description, a hash of hashes sounds like what you want, since the key to picking out the data you want is a string like "Paragraph5". If the search string is a hash key, getting the related values is simple and very fast.

      Dum Spiro Spero
      ... i didn't put the tag of code.

      Because you posted this as a registered user, you can go back and edit the post to add code tags. Please see How do I change/delete my post?.


      Give a man a fish:  <%-{-{-{-<

Re^4: insert data into data structure
by Anonymous Monk on Nov 30, 2015 at 12:44 UTC
    sorry, i wrote it fast, the right regex is =~ /^\.+\$/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2024-04-19 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found