Gossamer Forum
Home : General : Internet Technologies :

Hw 2 use "split" (in Perl) with PHP

Quote Reply
Hw 2 use "split" (in Perl) with PHP
Hi !

Please help me to convert this PERL code to PHP

FIle: member.txt
Lisa|lisa@yahoo.com|92134|408-224-2167
Kevin|kevin@yahoo.com|92346|408-223-2292
Tom|tom@yahoo.com|97321|408-943-2547
Tim|tim@yahoo.com|93876|408-356-2604

open(FILE, "/path/to/member\.txt") ;
@array = <FILE>;
close(FILE);

foreach $line(@array) {
chomp($line);
($name, $email, $zipcode, $phone) = split(/\|/, $line);
$print_line .="Name: $name<br>Email: $email<br>Zipcode: $zipcode<br>Phone: $phone<br><br>";
}

print "Content-type: text/html\n\n";
print $print_line;
exit;

Thanks !

PS: I'm learning PHP by convert Perl code to PHP code
Subject Author Views Date
Thread Hw 2 use "split" (in Perl) with PHP newage24 5234 Jun 22, 2003, 9:45 AM
Post Re: [newage24] Hw 2 use "split" (in Perl) with PHP
Mark Badolato 4943 Jun 22, 2003, 9:53 AM
Thread Re: [newage24] Hw 2 use "split" (in Perl) with PHP
Paul 4994 Jun 22, 2003, 10:31 AM
Post Re: [Paul] Hw 2 use "split" (in Perl) with PHP
Andy 4935 Jun 23, 2003, 1:47 AM