From: Jason Etheridge Date: Tue, 29 Jul 2008 19:10:21 +0000 (+0000) Subject: sample a line-oriented file X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=5fad774f93b66706058b06dda9eeca19d56e4f52 sample a line-oriented file --- diff --git a/spit_sample.pl b/spit_sample.pl new file mode 100755 index 0000000..69a72db --- /dev/null +++ b/spit_sample.pl @@ -0,0 +1,9 @@ +#!/usr/bin/perl +my @lines = <>; + +foreach my $i ( 1..20 ) { + $length = scalar( @lines ); + $idx = int rand ($length); + print $lines[$idx]; + splice(@lines,$idx,1); +}