Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

jimbus's scratchpad

by jimbus (Friar)
on Oct 25, 2005 at 11:47 UTC ( #502678=scratchpad: print w/ replies, xml ) Need Help??

Offending code

Hello,

I parse apart some reports and the data is 90deg out from how it needs to go into the DB. So I rotate it and go to print it out how I would insert it and... it don't work.

print Dumper %matrix; print Dumper @dates; for my $ii (0..$#dates - 1) { print "@dates[$ii], $matrix{youn}[$ii], $matrix{anch}[$ii], $matrix +{baxt}[$ii], $matrix{chey}[$ii], $matrix{aggr}[$ii]\n"; }

I get the following:

$VAR1 = { 'ANCHSN15K01' => [ '151659', '181307', '151184', '129956', '134802', '145494', '150087', '1044489' ], 'YOUNSN15K03' => [ '357296', '366914', '381503', '372149', '339996', '343442', '336182', '2497482' ], 'CHEYSN15KA01' => [ '254768', '264576', '279182', '273364', '244371', '246284', '245891', '1808436' ], 'BAXTSN15KA01' => [ '223618', '229512', '236444', '241737', '219792', '219184', '219379', '1589666' ] }; $VAR1 = '14 Mar 07'; $VAR2 = '15 Mar 07'; $VAR3 = '16 Mar 07'; $VAR4 = '17 Mar 07'; $VAR5 = '18 Mar 07'; $VAR6 = '19 Mar 07'; $VAR7 = '20 Mar 07'; $VAR8 = 'AGGR.'; 14 Mar 07, , , , , 15 Mar 07, , , , , 16 Mar 07, , , , , 17 Mar 07, , , , , 18 Mar 07, , , , , 19 Mar 07, , , , , 20 Mar 07, , , , ,
Here is how I'm creating the hash
tie my @lines, 'Tie::File', $data; my %matrix = (); my @dates; for my $ii (0 .. $#lines -1) { $lines[$ii] =~ s/\"//g; my @tmp = split /,/, $lines[$ii]; if ($ii == 0) { @dates = @tmp[2..$#tmp]; next; } $matrix{$tmp[0]} = [@tmp[2..$#tmp]]; }

Thanks,

JimB </code>

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-07-13 04:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (245 votes), past polls