sub Esoda_Statistika_button { my @totalExoda = 0; my $sum = 0; my $clearedValue=0; chdir "/home/props/delice/eksoda" or die "didn't make to eksoda folder\n"; foreach my $file (glob '*.txt') { open IN, $file; while () { if ($_ =~ m/(Exoda.*Total:)(.*\d)/) { $clearedValue =$2; push(@totalExoda,$clearedValue); } #end while foreach (@totalExoda){ $sum+= $clearedValue; print "$sum\n"; } #end if } #end foreach } } #### sub Esoda_Statistika_button { my @totalExoda = 0; my $sum = 0; my $clearedValue=0; chdir "/home/props/delice/eksoda" or die "didn't make to eksoda folder\n"; foreach my $file (glob '*.txt') { open IN, $file; while () { if ($_ =~ m/(Exoda.*Total:)(.*\d)/) { $clearedValue =$2; push(@totalExoda,$clearedValue); } } foreach (@totalExoda){ $sum+= $_; } print "$sum\n"; } }