Created
December 4, 2015 01:32
-
-
Save tomcha/558feae8527d9788cf77 to your computer and use it in GitHub Desktop.
48
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 @num; | |
@num = (1..1000); | |
my @rev_num = reverse @num; | |
# エラーの時の挙動を調べる為に、 | |
# my @sort_num = sort @rev_num; | |
# も試してみましょう。 | |
my @sort_num = sort{$a <=> $b}@rev_num; | |
for my $i (0..999){ | |
if ($num[$i] == $sort_num[$i]){ | |
print "$i => ok\n"; | |
}else{ | |
print "$i番目の要素の\@numの値は$num[$i]、\@sort_numの値は$sort_num[$i]です。\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment