in reply to File Parsing Question

Thank You hippo and choroba!. Works now
my $share; my %exports; my $host; while ( my $line = <DATA>) { chomp $line; if ( $line =~ /^ok:\s+\[/ ) { ($host = $line) =~ s/ok:\s+\[(.*)\].*/$1/s; } if ($line =~ /nfs/) { ($share = $line) =~ s/\s+"(.*)\s+nfs.*/$1/; $share =~ s/\s+//g; push @{ $exports{$share} }, $host; } } for my $key ( keys %exports ) { print "$key: ", join(",", @{ $exports{$key} }), "\n" }