Bulls and cows/Player: Difference between revisions

Content added Content deleted
m (Automated syntax highlighting fixup (second round - minor fixes))
m (→‎{{header|Perl}}: future-proof for 5.36, explicit :prototype)
Line 2,425: Line 2,425:
Expected 0 / 1, got 1 / 0.</pre>
Expected 0 / 1, got 1 / 0.</pre>
=={{header|Perl}}==
=={{header|Perl}}==
{{works with|Perl 5.10.0 and above}}

<syntaxhighlight lang="perl">#!/usr/bin/perl
<syntaxhighlight lang="perl">#!/usr/bin/perl
use warnings;
use warnings;
Line 2,442: Line 2,440:
# $+{BULLS} and $+{COWS}.
# $+{BULLS} and $+{COWS}.


sub read_score($) {
sub read_score :prototype($) {
(my $guess) = @_;
(my $guess) = @_;


Line 2,456: Line 2,454:
}
}


sub score_correct($$$$) {
sub score_correct :prototype($$$$) {
my ($a, $b, $bulls, $cows) = @_;
my ($a, $b, $bulls, $cows) = @_;


Line 2,494: Line 2,492:
Your secret number is 1357
Your secret number is 1357
msl@64Lucid:~/perl$</syntaxhighlight>
msl@64Lucid:~/perl$</syntaxhighlight>

=={{header|Phix}}==
=={{header|Phix}}==
{{Trans|Euphoria}}
{{Trans|Euphoria}}