#!/usr/bin/pugs #http://svn.perl.org/perl6/pugs/trunk/examples/games/bowling2.p6 use v6; print "How many bowlers are on your team?"; my $bowlers = =$*IN; print "How many games would you like to average?"; my $games = =$*IN; my @bowlers; for (1 .. $bowlers) { my $bowler; say "Enter scores for bowler $_:"; for (1.. $games) { print "game $_ score:"; my $score = =$*IN; $bowler.push( $score ); } $bowler = $_; $bowler = [+] @{$bowler}; $bowler = $bowler / $games; $bowler = int ( (200 - $bowler) * .8); @bowlers.push($bowler); } for @bowlers -> $bowler { say "Bowler $bowler's average is $bowler\tHandicap: $bowler"; } my $team_handicap = [+] @bowlers.map:{ $_. }; say "Team handicap is: $team_handicap";