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 =~ /^\.+\$/