in reply to Printing Array Output Outisde foreach
my (@both,@last_second,@last_first); foreach $line (@sorted_data) { chomp $line; $line =~ /(.*?)\,(.*?)\,(.*)/; $first = $1; $second = $2; $last = $3; if ($last eq $second and $second eq $first) { push(@both,"$last = $second and $second = $first"); } elsif ($last eq $second) { push(@last_second,"$last = $second"); } elsif ($last eq $first) { push(@last_first,"$last = $first"); } } print "both\n", join("\n",@both), "\n"; print "last_second\n", join("\n",@last_second), "\n"; print "last_first\n", join("\n",@last_first), "\n";
|
|---|