projects
/
migration-tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
5419447
)
sample a line-oriented file
author
Jason Etheridge
<jason@esilibrary.com>
Tue, 29 Jul 2008 19:10:21 +0000 (19:10 +0000)
committer
Jason Etheridge
<jason@esilibrary.com>
Tue, 29 Jul 2008 19:10:21 +0000 (19:10 +0000)
spit_sample.pl
[new file with mode: 0755]
patch
|
blob
diff --git a/spit_sample.pl
b/spit_sample.pl
new file mode 100755
(executable)
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);
+}