Created
February 22, 2011 22:02
-
-
Save christo/839521 to your computer and use it in GitHub Desktop.
print a random line from a file
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 | |
use warnings; | |
open FH, $ARGV[0] or die; | |
@lines = <FH>; | |
print @lines[int(rand(scalar @lines))] . "\n"; | |
close FH; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment