open FILE, "data.txt"; while() chomp; ($name,$phone,$address)=split(/\|/); #splits the default variable $_ on | #notice we have to put \| since | is a metacharacter #that represents or. Otherwise we'd be matching #empty string or empty string #then we place the results in variables instead of a list #the parentheses around the variable names need #to be there for this to work properly print "Name: $name\n"; #Now we print out the information in a more readable form print "Phone Number: $phone\n"; print "Address: $address\n\n"; } close FILE;