Random Futurama

| 2 Comments | Bookmark and Share

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]"";

2 Comments

my @files = glob(*avi);

Good tip; I often forget about Perl's own functions.

Leave a comment

About this Entry

This page contains a single entry by Drew Stephens published on December 11, 2007 7:36 PM.

Custom Weather Radar Images was the previous entry in this blog.

Web Browsing With Python is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 5.1