in reply to Why is my array empty?
#!/usr/bin/perl -w # Open our datafile open(INPUT, '< graduate.output.txt') or die "Couldn't open the file for reading\n"; # build a data structure @url_info = <INPUT>; close(INPUT); while(1){ print "Pick a number: "; chomp($index = <STDIN>); next if ($index >= scalar(@url_info)); if($index =~ /^q/i){ last; } @f = split(/,\s*/, $url_info[$index]); print "Link: $f[0]\n"; }
|
|---|