in reply to Re^3: Data manipulation on a file
in thread Data manipulation on a file
Thanks for the replies, I am just about there with what I am needing. The print comes out nicely to STD out however I am a little confused as to how I assign the output to a scalar $output = . In the for loop what syntax is needed to assign the result to a variable concatinating each time. Once the loop of the hash is assigned to a $output then I can take it from there. Many thanks and sorry for the silly quesitons
#!/usr/bin/perl use strict; use warnings; my $filer; my %filer_hash; for (qx(mount -t nfs | awk -F/ '{print \$1,\$3}' | sed -r 's/(blah.*:) +|(bblah.*:)//g' |sort)) { chomp; my ($host, $mp) = split; push @{ $filer_hash{$host} }, $mp; } foreach $filer ( sort { ${filer_hash{$b}} <=> ${filer_hash{$a}} } keys + %filer_hash ) { print "$filer:@{$filer_hash{$filer}}," }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Data manipulation on a file
by Corion (Patriarch) on Oct 01, 2015 at 09:34 UTC | |
by sstruthe (Novice) on Oct 01, 2015 at 10:26 UTC | |
|
Re^5: Data manipulation on a file
by sstruthe (Novice) on Oct 02, 2015 at 20:50 UTC | |
by CountZero (Bishop) on Oct 02, 2015 at 21:23 UTC | |
by sstruthe (Novice) on Oct 02, 2015 at 21:38 UTC | |
by CountZero (Bishop) on Oct 02, 2015 at 21:41 UTC | |
by sstruthe (Novice) on Oct 04, 2015 at 18:20 UTC |