Created
August 20, 2014 06:57
-
-
Save Code-Hex/4733f8538a7edece957d to your computer and use it in GitHub Desktop.
Perl 練習問題 回答よりも優れてたと思うw
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/perl | |
use strict; | |
use warnings; | |
my $n = "\n"; | |
print "Please input number 1~7" . $n; | |
my @lines = <STDIN>; | |
chomp @lines; | |
print $n; | |
my @array = qw/fred betty barney dino wilma pebbles bamm-bamm/; | |
my @box; | |
print "input data: " . $n; | |
my $i = 0; | |
for (@lines){ | |
$box[$i] = $array[$_-1]; | |
$i++; | |
} | |
print "$_ " foreach (sort @box); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
問題は "文字列のリストを(1行に1個ずつ)入力の終わりまで読み込んで、読み込んだ文字列をASCIIコード順に表示せよ" ってやつ。
工夫したのは数字で名前を呼び出すって所だけだけどww