in reply to insert data into data structure

Hi Genmai, welcome to the Monastery!

Can you show us what you tried? We can probably find the errors in your code, which would help you learn much more than just using someone else's code.

Hash of hashes seems sufficient for what you've described:

Paragraph1 => { key1 => 'value1', key2 => 'value2', }, ...
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: insert data into data structure
by Genmai (Initiate) on Nov 30, 2015 at 10:16 UTC
    I really would like to show you some code but there is no good code to show and the one i had i just deleted it. This is more or less the code i had before falling asleep in the chair yesterday:
    for my $line (@data)
    {
        if($line =~ /^\.+\$/)
        {
            $nameTmp = $line;
            push @listSection, $nameTmp, \@arrTmp;
        }
        elsif($line =~ /(.+)=(.+)|#(.*)/)
        {
            %hashTmp =
            (
            key => "$1",
            value => "$2",
            comment => "$3",
            );
            push @arrTmp, \%hashTmp;
        }
    }
    print "\n";
    print Dumper(@listSection);
      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!

        sorry, i wrote it fast, the right regex is  ($line =~ /^\[.+\]$/) i didn't put the tag of code.
        sorry, i wrote it fast, the right regex is =~ /^\.+\$/