rand($.) < 1 && ($line = $_) while <>;
<> is a common way to read stdin, and the value is assigned to the $_ special variable.
The one I didn't know was $., the current input line number. In other words, its your loop index that automatically increments.
http://www.kichwa.com/quik_ref/spec_variables.html
[1] - http://www.perl.com/doc/FMTEYEWTK/random
<> is a common way to read stdin, and the value is assigned to the $_ special variable.
The one I didn't know was $., the current input line number. In other words, its your loop index that automatically increments.
http://www.kichwa.com/quik_ref/spec_variables.html