use strict; use warnings; use utf8; use Data::Dumper; use List::Util qw(sum); my $inp = ; my @array = splir(" ", $inp); print &SUM( @array ), "\n"; sub SUM { return( List::Util::sum(@_) ); }