
PeterLove
Deleted
Jun 11, 2000, 8:22 PM
Post #1 of 2
(152 views)
|
|
Shifting Arrays
|
Can't Post
|
|
I’m trying to take the content from a file named myfile.txt and put it into an array then take the first value in the array and just print it. The problem is I can only get this to work on my computer. When I’m trying to get it to work on a webpage and print $key from another sub function is just doesn’t work. I could really use some help here. I've been working on this for awhile but I just can’t figure out why it doesn’t work. Here is what I have: sub getinfo { open(OPTIONS, "myfile.txt"); while(<OPTIONS> ) { chomp($_); @info = split(/:/, $_, 4); $key = shift(@info); $infoHash{$info[0]} = join(":", @info); } close(OPTIONS); } myfile.txt includes: 1811:2:ugly:18 And to print: sub printme { print "<td><font face=verdana,arial,helvetica size=2>$key</font></td>"; }
|