Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Retrieve average

by Laurent_R (Canon)
on Feb 12, 2019 at 20:17 UTC ( [id://1229838]=note: print w/replies, xml ) Need Help??


in reply to Retrieve average

$ perl -wE 'my $str = "Charles 25 24 26"; my ($name, @vals) = split /\ +s+/, $str; $sum += $_ for @vals; say $sum / @vals;' 25
Or possibly better:
$ perl -wE 'my $str = "Charles 25 24 26"; my ($name, @vals) = split / +\s+/, $str; my $sum = 0; $sum += $_ for @vals; say $sum / @vals;' 25

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (8)
As of 2024-04-23 09:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found