Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Hash to table with multiple attributes

by onelander (Sexton)
on Jul 19, 2013 at 03:35 UTC ( #1045242=note: print w/ replies, xml ) Need Help??


in reply to Hash to table with multiple attributes

I am closer to my answer so in the interest of other people seeing how far I have come here is where I have made changes. This is the correct column output but now I have to figure out the rows and I am going to work on a few ideas.

foreach my $op ( keys %{ $ops_hash{$q_date} } ) { push (@ops_array, $op); } $~ = HEADER; write; $~ = DATA; for ( 0 .. 23 ) { my $row_time = $_; foreach my $op_name ( @ops_array ) { foreach my $op_proc ( sort keys %{ $ops_hash{$q_date}{$op_name +} } ) { my $op_start_time = $ops_hash{$q_date}{$op_name}{$op_proc} +{'start'}; if ( ! defined $ops_hash{$q_date}{$op_name}{$op_proc}{'end +'} ) { $op_end_time = $hour; } else { $op_end_time = $ops_hash{$q_date}{$op_name}{$op_proc}{ +'end'}; } $time = $row_time; $move_data = ( ($op_name =~ /MOVE DATA/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $backup = ( ($op_name =~ /BACKUP STORAGE/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $migrate = ( ($op_name =~ /MIGRATION/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $prepare = ( ($op_name =~ /PREPARE/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $checkin = ( ($op_name =~ /CHECKIN/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $reclaim = ( ($op_name =~ /RECLAMATION/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $restore = ( ($op_name =~ /RESTORE/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $move = ( ($op_name =~ /MOVE DRMEDIA/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $expire = ( ($op_name =~ /EXPIRE/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; $db = ( ($op_name =~ /Database Backup/) && ( ( $row +_time >= $op_start_time ) && ( $row_time <= $op_end_time ) ) ) ? "X" +: "_"; # if ( # ( $move_data eq "_" ) && # ( $backup eq "_" ) && # ( $migrate eq "_" ) && # ( $prepare eq "_" ) && # ( $checkin eq "_" ) && # ( $reclaim eq "_" ) && # ( $restore eq "_" ) && # ( $move eq "_" ) && # ( $db eq "_" ) ) { # next; # } write; } #write; } #write; } format HEADER = Hour MOVE DATA BACKUP STORAGE POOL MIGRATION PREPARE CHECKIN + LIBVOLUME SPACE RECLAMATION RESTORE VOLUME MOVE DRMEDIA EXPI +RE INVENTORY Database Backup . format DATA = @|| @|| @|| @|| @|| + @|| @|| @|| @|| + @|| @|| $time, $move_data, $backup, $migrate, $prepare, +$checkin, $reclaim, $restore, $move, +$expire, $db .


Comment on Re: Hash to table with multiple attributes
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045242]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2015-07-01 22:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (24 votes), past polls