can anybody explain me this print statement in the following perl program.
#! /usr/bin/perl
use strict;
my %hash;
&Parse('first.txt');
&Parse('second.txt');
my $outputpath = 'output.txt';
unlink ($outputpath);
open (OUTPUT, ">>$outputpath") || die "Failed to open OUTPUT ($outputpath) - $!";
print OUTPUT "$_ \t" . join("\t", @{$hash{$_}}) . "\n" foreach (sort keys %hash);
close (OUTPUT) || die "Failed to close OUTPUT ($outputpath) - $!";
sub Parse {
my $inputpath = shift;
open (INPUT, "<$inputpath") || die "Failed to open INPUT ($inputpath) - $!";
while (<INPUT>) {
chomp;
my @row = split(/\t/, $_);
my $col1 = $row[0];
shift @row;
push(@{$hash{$col1}}, @row);
}
close (INPUT) || die "Failed to close INPUT ($inputpath) - $!";
return 1;
}
this is the statement:
print OUTPUT "$_ \t" . join("\t", @{$hash{$_}}) . "\n" foreach (sort keys %hash);