#!/usr/bin/perl use Data::Dumper; open(PLAYLIST,") { chomp(); push(@songs,$_); } my $count = scalar(@songs); print "We found $count songs\n"; while (scalar(@songs) > 0) { my $song_num = rand(scalar(@songs)); print "*** Playing $songs[$song_num]\n"; `mpg321 '$songs[$song_num]'`; splice(@songs,$song_num,1); }