Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: printing out a matrix for a data list

by TedPride (Priest)
on Aug 06, 2006 at 22:20 UTC ( #565875=note: print w/replies, xml ) Need Help??


in reply to printing out a matrix for a data list

Very basic hack:
use strict; use warnings; my ($delim, $row, $col, $val, %matrix, %cols, @rows, @cols) = ' '; while (<DATA>) { chomp; ($row, $col, $val) = split /, /, $_; $matrix{$row}{$col} = $val; $cols{$col} = (); } @cols = sort keys %cols; @rows = sort keys %matrix; print join $delim, ' ', @cols; for $row (@rows) { print "\n", $row; for $col (@cols) { print $delim, $matrix{$row}{$col} ? sprintf('%3d', $matrix{$ro +w}{$col}) : ' -'; } } __DATA__ ob1, ob2, 34 ob1, ob3, 56 ob1, ob4, 12 ob1, ob5, 78 ob1, ob6, 23 ob3, ob1, 56 ob7, ob1, 23 ob8, ob1, 12 ob9, ob1, 90

Replies are listed 'Best First'.
Re^2: printing out a matrix for a data list
by Angharad (Pilgrim) on Aug 07, 2006 at 09:19 UTC
    Thank you. Your help is much appreciated :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://565875]
help
Chatterbox?
[Corion]: Weird - this "Install our backdoor SDK" spam is persistent. And I get the feeling it's not even automated, as it seems to be a re-forward of each mail, maybe even manually. Ah well, a quick rule in Thunderbird will move them to Spam automatically now :D
[Corion]: (the "backdoor SDK" is for distributing my software with an included backdoor, not for backdooring my own machine)
[marto]: ask for a trial
[marto]: then trick them into running your app
[marto]: once you have access, remove your email address from their system :P

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2018-05-25 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?