Created
April 12, 2019 06:52
-
-
Save hiroshi-manabe/5259438ef8c30d75c16e596ce4949a04 to your computer and use it in GitHub Desktop.
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 -nl | |
use Getopt::Std; | |
BEGIN { | |
getopt("n:" => \%o); | |
$n = $o{"n"} ||= 10; | |
} | |
$t = $. <= $n ? $. - 1 : rand($.); | |
$r[$t] = $_ if $t < $n; | |
END { | |
print for @r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment