Created
December 19, 2015 04:16
-
-
Save tomcha/03c3008a9b667167f979 to your computer and use it in GitHub Desktop.
ouyou1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my @words = ('肉','イカ','ラッパ','カニ','クジラ'); | |
my @shiritori; | |
$shiritori[0] = $words[1]; | |
$shiritori[1] = $words[3]; | |
$shiritori[2] = $words[0]; | |
$shiritori[3] = $words[4]; | |
$shiritori[4] = $words[2]; | |
# 解答例1 | |
for my $str (@shiritori){ | |
print $str; | |
print "->" if $str ne $shiritori[4]; | |
} | |
print "\n"; | |
# 解答例2 | |
print join '->', @shiritori; | |
print "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment