Random Futurama
I like Futurama. All of it. Though I occasionally have a hankering for a specific episode, I often just want /any/ episode, so I wrote a quick Perl script to play one at random. I have a directory filled with all of Futurama, so this is an easy proposition:
#!/usr/bin/perl use strict; use warnings; my @files = split /\n/, `ls *avi`; my $num = rand(scalar(@files)); system "mplayer "$files[$num]"";


my @files = glob(*avi);
[Reply]
Comment by WXS — December 12, 2007 @ 2:06 pm
Good tip; I often forget about Perl’s own functions.
[Reply]
Comment by Drew Stephens — December 12, 2007 @ 2:41 pm