Skip to content

Instantly share code, notes, and snippets.

@tuantranf
Created February 15, 2019 04:23
Show Gist options
  • Save tuantranf/d9e3e34a19e81d14ad6f7aceab1c598d to your computer and use it in GitHub Desktop.
Save tuantranf/d9e3e34a19e81d14ad6f7aceab1c598d to your computer and use it in GitHub Desktop.
sub func02 {
my ( $a, $b ) = @_;
if ( $a eq 'g' ) {
if ( $b eq 'c' ) {
print "win";
} elsif ( $b eq 'p' ) {
print "lose";
} else {
print "draw";
}
}
if ( $a eq 'c' ) {
if ( $b eq 'p' ) {
print "win";
} elsif ( $b eq 'g' ) {
print "lose";
} else {
print "draw";
}
}
if ( $a eq 'p' ) {
if ( $b eq 'g' ) {
print "win";
} elsif ( $b eq 'c' ) {
print "lose";
} else {
print "draw";
}
}
}
sub func01 {
my $line = shift;
my ( $a, $b ) = split / /, $line;
&func02( $a, $b );
}
my $line = <>;
chomp $line;
&func01($line);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment