Skip to content

Instantly share code, notes, and snippets.

@tomcha
Created December 19, 2015 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomcha/03c3008a9b667167f979 to your computer and use it in GitHub Desktop.
Save tomcha/03c3008a9b667167f979 to your computer and use it in GitHub Desktop.
ouyou1
#!/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