Well, i understand what pieces i am using but i wonder the logic behind it.#!/usr/bin/perl -w $sum=0; $count=0; open(INPUT,"meres.txt") or die "ERROR"; while($line=<INPUT>) { chomp($line); if($line=~/([-\d]+(\d+)*)/){ #print($1."\n"); $sum+=$1; $count++; } } close(INPUT); print $sum/$count; print "\n";
In reply to Why this is work? by Csonytii
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |