Name "main::res" used only once: possible typo at ./ave.pl line 6. Use of uninitialized value $d in print at ./ave.pl line 7.