Time to flex those Golf skills.

Soccer leagues are often listed by points earned and games played. A team earns 3 points for a win and 1 point for a tie. Zero points are earned for a loss.
The challenge is to create a function that gets two scalars, gamesPlayed and pointsEarned and returns three scalars, winTotal, lossTotal, and tieTotal.
For this golf, ignore the possibility that the team may have more than 2 ties.

A non-golfed example is presented to give you somewhere to start.

sub record { my ($gp, $pts) = @_; my $win = 3; my $tie = 1; my ($winTot, $lossTot, $tieTot); $winTot = int ($pts / $win); $tieTot = $pts - ( $winTot * $win ); $lossTot = $gp - ( $winTot + $tieTot); return ($winTot, $lossTot, $tieTot); }

In reply to Golf Soccer Stats by SparkeyG

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.