In the top level folder, the script snippet below does fine. Opens a text file that holds a list of pages that are one the site so the can be worked into the new page. In the subfolder, the it opens the text file, parses the first line and then seems to fail to recognize the new line and just fizzles out.
open LINKLIST, "$text" or die $!;while (<LINKLIST>) {
local $/ = undef;
@catfile = split/\t/,$_;
$artname = $catfile[0];
$artlink = $catfile[1];
$alphalist{$artname} = $artlink;
}
I am just a perl hack, so I can't even fathom why this might happen. I have tried reuploading the text file several times and that has not helped. Would anybody know?
This has been tested & works:
use strict;
use warnings;
my($text) = 'testfile.txt';
my(%alphalist);
open (LINKLIST, "<$text") or die $!;
while (<LINKLIST>) {
chomp;
my($artname, $artlink) = split;
$alphalist{$artname} = $artlink;
}
close(LINKLIST);
This is what happens. The file looks like this:
Article A(tab)http://www.example.com/art1.htm
Article B(tab)http://www.example.com/art2.htm
Article C(tab)http://www.example.com/art3.htm
I added a print line to see what it was picking up and this is what it will look like.
print "$artname - $artlink\n";
Prints this:
Article A - http://www.example.com/art1.htm Article B
And then the while loop stops working.
> Opens a text file that holds a list of pages
A list could still be a single line of text:
foo\tbar\tbaz\tboink
but the OP cleared that up, it is multiple lines.
I have no idea why the problem is occuring that he describes. Having the file in a sub folder of the cgi-bin should make no difference that I am aware of.