Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^7: Use of "my" after Perl v5.14

by Anonymous Monk
on Sep 21, 2012 at 02:41 UTC ( #994799=note: print w/ replies, xml ) Need Help??


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

use v5.14; sub total { my $sum = 0; foreach (@_) { $sum += $_; } say "list @_\nsum is $sum"; $sum; } say "Enter a list of number to calculate sum :"; my @numList = split /[,\s]+/, <STDIN>; chomp @numList; @numList = grep length, @numList; my $total = total(@numList); say "Total : $total"; __END__ Enter a list of number to calculate sum : 10 12 20 list 10 12 20 sum is 42 Total : 42


Comment on Re^7: Use of "my" after Perl v5.14
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994799]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2015-07-08 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (98 votes), past polls