Rev 70 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#! /usr/bin/env perl
use warnings;
use strict;
use YAML::Tiny;
use Data::Dumper;
my $input = join( '', <> );
my @data = Load($input);
my $hashref = $data[0];
#print Dumper( $hashref );
#die;
foreach my $group ( sort keys %$hashref ) {
if ( $group ) { # only do a group header if it is not empty
my $header = '#'x10 . " $group " . '#'x10;
my $length = length( $header );
print "\n" . join( "\n", ( '#'x$length, $header, '#'x$length ) ) . "\n";
}
foreach my $host ( sort keys %{$hashref->{$group}} ) {
print "\nHost " . $host . "\n";
foreach my $key ( sort keys %{$hashref->{$group}->{$host}} ) {
print "$key $hashref->{$group}->{$host}->{$key}\n";
}
}
}
1;