# You are using strict, right??? :-) use strict; my $adfile = 'banners.dat'; open(FILE, $adfile) || die "Can't open $adfile"; # Loops through the data file, 1 line at a time while() { # Split apart the line of data, put it in an array my @part = split(/\|/, $_); # Print's the url from the data line print "$part[0]\n"; } # Close up the file close(FILE); #### srand; # This chooses a random line, and puts that line into # the var $line. rand($.) < 1 && ($line = $_) while ; # Now you can split it my @part = split(/\|/,$line); # And then do whatever else with it... print "$part[0] $part[1] $part[2] ... ";