$n = int rand `wc -l $file`; do { $l = $_ if $. == $n } while <>;