data67 has asked for the wisdom of the Perl Monks concerning the following question:
PROBLEM
The problem I have been having is essentially with the data structure part of the script. I have played with the following code and will elaborate.
CODE
#!/usr/local/bin/perl use Data::Dumper; # GET DEVTOOLS open (DTOOLS, "devtools.data"); @devtools= <DTOOLS>; close (DTOOLS); # GET SYSINFO open (SYS, "sysinfo.data"); @system= <SYS>; close (SYS); foreach $line (@devtools) { ($sys, $pp, $midd, $fos, $db, $dbt, $dlang, $fil, $dtools, $st +ools, $scm, $tt, $dest, $url, $lastupdate) = split (/!/, $line); # Build HoH for devtools; $HoH{$sys}{'Production Platforms'} = $pp; $HoH{$sys}{'Middleware'} = $midd; $HoH{$sys}{'Fail Over Software'} = $fos; $HoH{$sys}{'Database'} = $db; $HoH{$sys}{'Database Tools'} = $dbt; $HoH{$sys}{'Development Languages'} = $dlang; $HoH{$sys}{'Found Internal Libraries'} = $fil; $HoH{$sys}{'Development Tools'} = $dtools; $HoH{$sys}{'Support Tools'} = $stools; $HoH{$sys}{'Source Code Management'} = $scm; $HoH{$sys}{'Test Tools'} = $tt; $HoH{$sys}{'Design Tools'} = $dest; $HoH{$sys}{'URL'} = $url; $HoH{$sys}{'Last Update'} = $lastupdate; } foreach $line (@system) { ($sys, $sys_name, $grp, $auth) = split (/!/, $line); # Build HoH for devtools; $HoH{$sys}{'System Name'} = $sys_name; $HoH{$sys}{'Group'} = $grp; $HoH{$sys}{'Authorization'} = $auth; } ##print Dumper(\%HoH);
Ok What i did above is open 2 files and set their data up is a Hash of Hash called HOH.
Here is what the data looks like if i do a print Dumper(\%HoH);.
$VAR1 = { '1018884184639' => { 'Group' => 'Marketing', 'System Name' => '1018884184639', 'Authorization' => 'mrossa' }, '1017939213033' => { 'Group' => 'Sales', 'System Name' => '1017939213033', 'Last Update' => 'Thu Apr 18 14:29:30 2 +002', 'Support Tools' => 'EGstools', 'Source Code Management' => 'EGscm', 'Production Platforms' => 'EGpp', 'Design Tools' => 'EGdest', 'Authorization' => 'dsmith', 'Test Tools' => 'EGtt', 'Database' => 'EGdb', 'URL' => 'http://www.perlmonks.com', 'Middleware' => 'EGmidd', 'Database Tools' => 'EGdb', 'Found Internal Libraries' => 'EGfdxi', 'Development Languages' => 'EGdl', 'Development Tools' => 'EGdtools', 'Fail Over Software' => 'EGfos' }, '1017939028902' => { 'Group' => 'Shipping', 'System Name' => '1017939028902', 'Last Update' => 'Fri Mar 29 10:32:44 2 +002', 'Support Tools' => '9', 'Source Code Management' => '10', 'Production Platforms' => '1', 'Design Tools' => '12', 'Authorization' => 'ecartman', 'Test Tools' => '11', 'Database' => '4', 'URL' => 'http://www.osdncom', 'Middleware' => '2', 'Database Tools' => '5', 'Found Internal Libraries' => '7', 'Development Languages' => '6', 'Development Tools' => '8', 'Fail Over Software' => '3' }, };
QUESTION
No. 1 How can i make each reacord (record is the number) here into a single line delimited by something.
No. 2 (this is the one that i have been stuck on)
How can i print this by CLASSIFICATION TYPE. By that i mean that if you look close at the data. It is classified
by things like (database, database-tools, test-tools etc.) Now i was trying to print this like so:
Database: MySQL - Marketing....etc Oracle - Sales....etc Sybase - Shipping....etc Database-tools: Tool-x - Accunting....etc Tool-y - SHipping...etc Tool-z - IT...etc Test-tools T-Tool-x - IT...etc T-Tool-y - Accuniting...etc T-Tool-z - Sales...etc
You see what i tried to do is classyify each record by a specific type of data.
As always, any input will go a long ways.
( GO ARGENTINA, WIN WIN WIN WORLD CUP!!!!)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Data Structures and Sorting
by robobunny (Friar) on Jun 11, 2002 at 18:01 UTC | |
by data67 (Monk) on Jun 11, 2002 at 21:16 UTC | |
|
Re: Data Structures and Sorting
by DamnDirtyApe (Curate) on Jun 12, 2002 at 05:01 UTC | |
|
Re: Data Structures and Sorting
by davis (Vicar) on Jun 12, 2002 at 09:19 UTC |