#!/usr/bin/perl use strict; use warnings; print "Durchschnitt: ".(x(\(my $i=0)))[0]."\n"; sub x { (local $_=) eq "\n" and return 0; (/^\d+/ && ++${$_[0]}) or die("NO NUMBER"); return x($_[0])+($_/${$_[0]}); }