View Single Post
Old 12-06-2011, 03:25 PM   PM User | #25
FishMonger
Super Moderator


 
Join Date: May 2005
Location: Southern tip of Silicon Valley
Posts: 2,753
Thanks: 2
Thanked 149 Times in 144 Posts
FishMonger will become famous soon enoughFishMonger will become famous soon enough
%licenses is a Hash-of-Arrays so you'll need to use a nested loop to dereference the array.

Also, why are you not taking my advise about the proper/best way to open a filehandle?

Code:
open my $license_fh, '>', $newFile or die "failed to open '$newFile' <$!>";

foreach my $hostname ( keys %licenses ) {
    foreach my $license ( @{ $licenses{ $hostname } } ) {
        print {$license_fh} "$hostname $license\n";
    }
}
FishMonger is offline   Reply With Quote