• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

more help with perl

LawTown Junky

New Member
if i make a file say called data.txt or something stupid and in this file it has lines like this

john doe|18|14|jeff|green

where john doe is the name then the age and then lets say fav number and then fav color


how do i have it read this file and print on the page

name: john doe
age: 18
fav numba: 14
fav color: green

yet anotha simple task that i do not know how to do
 
For a datafile like:
john doe|18|14|jeff|green

Code:
open(FILE,"/path/to/file");

while(<FILE>)
{
	my($name, $age, $favoriteNumber, $thatJeffThing, $favoriteColor) = split(/\|/);
	print "all the stuff out however you want";
}

close(FILE);

mjk@atlascgi.com
 
Back
Top