in reply to Re^5: Use of "my" after Perl v5.14
in thread Use of "my" after Perl v5.14

I have this code: -

#!/perl/bin use v5.14; sub total { local $::@numList = @_; # This line is giving Compiler error.. my $sum = 0; # ForEach is not working in this case.. Even when I use my @nu +mList in declaration.. foreach (@numList) { say "list ", @numList; # Printing 3 (if 1, 2, 3) is input.. say "sum is : $sum"; $sum += $_; } $sum; } say "Enter a list of number to calculate sum :"; my $total = total(chomp(my @numList = <STDIN>)); say "Total : $total";
I can't understand what can be the problem with the code.. I am trying to find the total of some integer from user input..