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 having an uproarious good time at the Monastery: (4)
As of 2014-10-01 10:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (7 votes), past polls