bostoncybertech
asked on
Converting short perl script to php
For a perl script I made a while ago for a highcore table for games, I would like to convert to PHP to hold a database of web addresses for an entirely seperate purpose, but it's still among the same lines. I just changed some text down below from highscore to address. I'm just curious how I'm going to change a lot of the code. For instance, chomp and recalling a database from a text file.
#!perl
print "Expires: -1\n";
print "Content-type: text/html\n\n";
$filename = "addresses.txt";
open(DATABASE, $filename);
@addresses = <DATABASE>;
close DATABASE;
print "addresses=";
foreach (@addresses){
@address_entry = split('-',$_);
chomp @address_entry[0];
chomp @address_entry[1];
print ++$couner . ". ";
printf "%-9s", @address_entry[1];
printf "%9i\r", @address_entry[0];
}
exit;
Thanks.
#!perl
print "Expires: -1\n";
print "Content-type: text/html\n\n";
$filename = "addresses.txt";
open(DATABASE, $filename);
@addresses = <DATABASE>;
close DATABASE;
print "addresses=";
foreach (@addresses){
@address_entry = split('-',$_);
chomp @address_entry[0];
chomp @address_entry[1];
print ++$couner . ". ";
printf "%-9s", @address_entry[1];
printf "%9i\r", @address_entry[0];
}
exit;
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER