Brent Clark wrote:
Hi all

Hello,

Would anyone be so kind as to look at my code.

Im trying to create a hash of hashes

Thanks in advance

Brent Clark

while(<DATFILEREAD>){
    chomp;
    @linex = split(/\|/);
    my %xmlData =  (
        'bbookdate'   => $linex[0],
        'bbooktime'   => $linex[1],
        'bstayf'      => $linex[2],
        'bcode'       => $linex[3],
        'bhotel'      => $linex[4],
        'broomcde'    => $linex[5],
        'broom_name'  => $linex[6],
        'bnights'     => $linex[7],
        'badults'     => $linex[8],
        'bchilds'     => $linex[9],
        'bbookref'    => $linex[10],
        'bbookrefnum' => $linex[11],
        'bnames'      => $linex[12],
        'bnett_price' => $linex[13],
        'brrp_price'  => $linex[14],
        'bsell_price' => $linex[15],
        'bconfig'     => $linex[16],
        'bspecial1'   => $linex[17],
        'bspecial2'   => $linex[18],
        'bspecial3'   => $linex[19],
        'bspecial4'   => $linex[20],
        'breceived'   => $linex[21],
        'bauditdate'  => $linex[22],
        'baudittime'  => $linex[23],
        'baudituser'  => $linex[24],
        'btran1'      => $linex[25],
        'btran2'      => $linex[26],
        'bsellcur'    => $linex[27],
        'bregion'     => $linex[28],
        'bvouchnum1'  => $linex[29],
        'bvouchnum2'  => $linex[30],
        'bvouchnum3'  => $linex[31],
        'bbillcode'   => $linex[32],
        'bpuphhmm'    => $linex[33],
        'brethhmm'    => $linex[34]
        );
    %fullXmlHash{$xmlData{'bbookref'}} = %xmlData;

Your assignment is incorrect:

      $fullXmlHash{ $xmlData{ 'bbookref' } } = \%xmlData;


    }

You can save some typing by using a hash slice in the assignment:

    @{ $fullXmlHash{ $linex[ 10 ] } }{ qw(
        bbookdate
        bbooktime
        bstayf
        bcode
        bhotel
        broomcde
        broom_name
        bnights
        badults
        bchilds
        bbookref
        bbookrefnum
        bnames
        bnett_price
        brrp_price
        bsell_price
        bconfig
        bspecial1
        bspecial2
        bspecial3
        bspecial4
        breceived
        bauditdate
        baudittime
        baudituser
        btran1
        btran2
        bsellcur
        bregion
        bvouchnum1
        bvouchnum2
        bvouchnum3
        bbillcode
        bpuphhmm
        brethhmm  ) } = @linex;




John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to