#!/util/bin/perl # Uncle Foobar's Magic Redirection Device # call it as /cgi-bin/redirect?number, where number is the corresponding code $dbfile = "big.db"; open (DB,$dbfile); @lines = ; foreach $line (@lines) { $line =~ s/\n//g; @els = split(/\|/,$line); $url[$els[0]] = $els[3]; } close DB; $whereto = $ARGV[0]; if (!defined($whereto)) { die; } if ($url[$whereto] =~ /./) { print "Location: $url[$whereto]\n\n"; } else { print "Location: http://www.wnyweb.com/\n\n"; }