It would be good for you to wrap your code with code tags instead of pre tags, so a download code link would appear.

I didn't use <code></code> tags for this script simply because PerlMonks doesn't display the Unicode suit characters ♠, ♥, ♦ and ♣ properly when I do. See these discussions of the topic.

Here's what the same script looks like when I enclose it in <code></code> tags:

#!perl use strict; use warnings; use utf8; use open qw( :encoding(UTF-8) :std ); use List::Util qw( shuffle ); @ARGV == 1 or die "Usage: perl $0 <total rounds>\n"; my $TOTAL_ROUNDS = shift; my @players = qw( Bob Carol Ted Alice ); my $player_to_dealers_right = $players&#91;-1&#93;; # Alice my $round = 1; my %hand_of; my @deck; my @cards; for my $rank (qw( 2 3 4 5 6 7 8 9 10 J Q K A )) { for my $suit (qw( &#9824; &#9829; &#9830; &#9827; )) { push @cards, $rank . $suit; } } ROUND: while ($round <= $TOTAL_ROUNDS) { @deck = shuffle(@cards); SHUFFLE: while (@deck) { PLAYER: for my $player (@players) { push @{ $hand_of{$player} }, pop @deck; } if (@{ $hand_of{$player_to_dealers_right} } == 5) { print "Round $round\n"; for my $player (@players) { my $hand = join ' ', @{ $hand_of{$player} }; print "$player has $hand\n"; } print "\n"; %hand_of = (); last ROUND if ++$round > $TOTAL_ROUNDS; } } } __END__ Round 1 Bob has 7&#9829; 8&#9824; Q&#9829; 2&#9830; 9&#9829; Carol has 6&#9830; Q&#9824; 2&#9824; A&#9824; 3&#9830; Ted has K&#9829; 10&#9830; 5&#9830; 7&#9824; A&#9829; Alice has J&#9824; 10&#9829; 6&#9827; 6&#9829; K&#9824; Round 2 Bob has A&#9827; A&#9830; 9&#9827; 4&#9827; 2&#9829; Carol has 7&#9827; 4&#9830; 4&#9829; 8&#9829; 8&#9827; Ted has 6&#9824; J&#9827; K&#9830; 3&#9827; 9&#9824; Alice has 9&#9830; 7&#9830; Q&#9830; 8&#9830; 10&#9827; Round 3 Bob has 5&#9824; K&#9827; 3&#9824; 7&#9830; 7&#9829; Carol has 5&#9827; Q&#9827; 2&#9827; 9&#9827; Q&#9830; Ted has 3&#9829; 4&#9824; 10&#9824; J&#9830; 5&#9829; Alice has J&#9830; 5&#9829; J&#9829; A&#9824; 10&#9824; Round 4 Bob has K&#9827; J&#9829; 7&#9824; 4&#9824; J&#9824; Carol has 10&#9830; 9&#9830; Q&#9829; 9&#9829; 6&#9829; Ted has 10&#9827; 4&#9830; 4&#9827; 3&#9827; K&#9829; Alice has A&#9827; 5&#9830; 2&#9830; 3&#9830; 8&#9827; Round 5 Bob has 5&#9827; 2&#9827; 6&#9824; K&#9830; 2&#9824; Carol has A&#9830; 5&#9824; 6&#9827; 10&#9829; 4&#9829; Ted has 2&#9829; 9&#9824; A&#9829; Q&#9824; 7&#9827; Alice has 3&#9829; Q&#9827; K&#9824; 8&#9830; 8&#9824; Round 6 Bob has J&#9827; 2&#9824; J&#9829; 9&#9829; 6&#9824; Carol has 8&#9829; 10&#9827; 9&#9827; 5&#9827; 4&#9830; Ted has 3&#9824; K&#9829; K&#9827; A&#9830; Q&#9827; Alice has 6&#9830; 9&#9824; 3&#9829; 8&#9830; 9&#9830; Round 7 Bob has Q&#9829; 8&#9829; Q&#9830; 5&#9829; 3&#9827; Carol has 6&#9829; 10&#9829; 5&#9830; 7&#9827; 2&#9830; Ted has 10&#9830; 4&#9824; 4&#9829; 8&#9824; 7&#9830; Alice has J&#9824; 7&#9829; J&#9830; K&#9830; 2&#9827; Round 8 Bob has J&#9827; Q&#9824; 5&#9824; A&#9824; Q&#9824; Carol has 6&#9827; 8&#9827; A&#9829; A&#9827; 5&#9830; Ted has 10&#9824; 3&#9830; 3&#9824; 4&#9827; 6&#9829; Alice has 2&#9829; 6&#9830; K&#9824; 7&#9824; 7&#9824; Round 9 Bob has 3&#9829; 9&#9829; 8&#9830; 2&#9830; 7&#9827; Carol has 10&#9824; 6&#9830; 2&#9827; 4&#9827; J&#9824; Ted has 5&#9827; 4&#9829; 4&#9824; 3&#9824; 3&#9827; Alice has J&#9830; 7&#9830; 2&#9824; 8&#9829; Q&#9827; Round 10 Bob has 7&#9829; 10&#9830; J&#9829; A&#9827; 8&#9827; Carol has 9&#9830; 5&#9829; K&#9824; A&#9829; K&#9829; Ted has 5&#9824; 8&#9824; 4&#9830; 9&#9827; 2&#9829; Alice has A&#9830; 9&#9824; 6&#9824; 3&#9830; J&#9827;

In reply to Re^2: Perl Example of Control Break Processing by Jim
in thread Perl Example of Control Break Processing by Jim

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.