#!usr/local/bin/perl use strict; $|++; my ($c, $id, $image, $url, $type, @imgs, $img); open DAT, "ads.dat" or die "Error: cannot open data file!\n"; my @imgdata=; close DAT; $id = int(rand(scalar @imgdata)); $c = @imgdata[$id]; { chop $c; ($id,$image,$url,$type)=split(/\|/,$c); } print "Location: $type\n\n";