in reply to Re: Problem of Duplicating an Array while Parsing Text
in thread Problem of Duplicating an Array while Parsing Text

Thanks GrandFather, but it produce this instead:
$VAR1 = { 'mus09r' => [ [ [ 'AGAGAAAG 1', '7', '0.142138988325903', '3', '0', [ '7.66666666666667', '1,-424,CAGAGACAGGGGAGAGATAG', '1,-338,AAGAGAAAGGGAGGAGAGGC', '1,-349,AAGAGGGGAGGAAGAGAAAG' ] ], [ 'AGAGAAAG 1', '7', '0.142138988325903', '3', '0', [ '7.66666666666667', '1,-337,AGAGAAAGGGAGGAGAGGCA', '1,-348,AGAGGGGAGGAAGAGAAAGG', '1,-423,AGAGACAGGGGAGAGATAGA' ] ] ], [ $VAR1->{'mus09r'}[0][0], $VAR1->{'mus09r'}[0][1], [ 'AGAAACAG 1', '7', '1.36112386682747', '4', '4', [ '7.66666666666667', '1,-383,TGAGAAACAG', '1,-319,CAAGAAACAG', '0,-457,CTTGAAACAG' ] ] ] ] };
Which is still not quite right.

Regards,
Edward

Replies are listed 'Best First'.
Re^3: Problem of Duplicating an Array while Parsing Text
by GrandFather (Saint) on Dec 20, 2005 at 11:09 UTC

    You have an extra level introduced in the push @all and you need to flush @temp2:

    elsif ( $line =~ /\^+/xms ) { push @all, @temp2; @temp2 = (); }

    With both sets of changes applied to your original code it now prints:

    $VAR1 = { 'mus09r' => [ [ 'AGAGAAAG 1', '7', '0.142138988325903', '3', '0', [ '7.66666666666667', '1,-424,CAGAGACAGGGGAGAGATAG', '1,-338,AAGAGAAAGGGAGGAGAGGC', '1,-349,AAGAGGGGAGGAAGAGAAAG' ] ], [ 'AGAGAAAG 1', '7', '0.142138988325903', '3', '0', [ '7.66666666666667', '1,-337,AGAGAAAGGGAGGAGAGGCA', '1,-348,AGAGGGGAGGAAGAGAAAGG', '1,-423,AGAGACAGGGGAGAGATAGA' ] ], [ 'AGAAACAG 1', '7', '1.36112386682747', '4', '4', [ '7.66666666666667', '1,-383,TGAGAAACAG', '1,-319,CAAGAAACAG', '0,-457,CTTGAAACAG' ] ] ] };

    DWIM is Perl's answer to Gödel
Re^3: Problem of Duplicating an Array while Parsing Text
by tphyahoo (Vicar) on Dec 20, 2005 at 09:03 UTC
    I think your desired input doesn't match your desired output. Recheck your inputs, because you seem to have got them switched. Good luck.