Skip to content

Instantly share code, notes, and snippets.

@hiroshi-manabe
Created April 12, 2019 06:52
Show Gist options
  • Save hiroshi-manabe/5259438ef8c30d75c16e596ce4949a04 to your computer and use it in GitHub Desktop.
Save hiroshi-manabe/5259438ef8c30d75c16e596ce4949a04 to your computer and use it in GitHub Desktop.
#!/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