in reply to Re^2: Extract the number of the species for txt file
in thread Extract the number of the species for txt file

If you know the species in advance, there's no need to remember the counts for the remaining ones.
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; say my $search_for_species = 'O4'; while (<>) { my %counts; my @species = split; my @numbers = split ' ', <>; warn "Different number of columns at line $.!" if @species != @num +bers; for my $i (0 .. $#species) { $counts{ $species[$i] } = $numbers[$i]; } say $counts{$search_for_species} // 0; }

To output to a file, use redirection:

perl script_from_choroba.pl > new_file

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,