foreach my $line (@fuente) { my @parts = split /\|/, $line; print join("|", @parts[2]), "\n"; } foreach my $line (@fuente2) { my @parts = split /\|/, $line; print join("|", @parts[3]), "\n"; }