#!/usr/local/bin/perl -w # Randomize input lines srand; # make the rand function random while(<>){ push @lines, $_; } while(@lines) { print splice(@lines, rand @lines, 1); }