Created
December 19, 2015 04:32
-
-
Save tomcha/d0e4d33158e750c1142b to your computer and use it in GitHub Desktop.
ouyou3
This file contains hidden or 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 @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