Guest User

Untitled

a guest
Dec 15th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use Data::Dumper;
  4.  
  5. %hostgroups = (
  6. 'net47.dmz' => ['aidos','apache1'],
  7. 'net200.dmz' => ['aletheia','antispam1'],
  8. );
  9. # 'all' => ['agrios','aidos','aletheia','antispam1','apache1'],
  10.  
  11.  
  12. #%newhostgroups = (
  13. #'all' => [\@net47dmz, \@net200dmz]
  14. #);
  15.  
  16. #@{$hostgroups{'all'}} = [ $hostgroups{'net47.dmz'}, $hostgroups{'net200.dmz'} ];
  17. @{$hostgroups{'all'}} = [ \@{$hostgroups{'net47.dmz'}}, \@{$hostgroups{'net200.dmz'}} ];
  18.  
  19.  
  20. foreach $key (keys %hostgroups) {
  21. print "$key --> $hostgroups{$key}\n";
  22. }
  23.  
  24. print "\n-------------------------\n";
  25.  
  26. foreach $key (keys %hostgroups) {
  27. print "$key --> ";
  28. print $_." " foreach @{$hostgroups{$key}};
  29. print "\n";
  30. }
  31.  
  32.  
  33. #print Dumper(\%hostgroups);
Add Comment
Please, Sign In to add comment