Skip to content

Instantly share code, notes, and snippets.

@tomcha
Created December 19, 2015 04:32
Show Gist options
  • Select an option

  • Save tomcha/d0e4d33158e750c1142b to your computer and use it in GitHub Desktop.

Select an option

Save tomcha/d0e4d33158e750c1142b to your computer and use it in GitHub Desktop.
ouyou3
#!/usr/bin/env perl
use strict;
use warnings;
my @foods;
print "好きな食べ物を入力して下さい。入力を終える時は END と入力して下さい。\n";
for (;;){
print "好きな食べ物を入力して下さい>>";
my $str = <STDIN>;
chomp $str;
if ($str eq 'END'){
last;
}else{
push @foods, $str;
}
}
my @rev_foods = reverse @foods;
print "\n入力された食べ物を逆順に出力します。\n\n";
for my $food (@rev_foods){
print "$food\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment