#!/usr/bin/perl
# w6.5.pl: Show food.
# To try this   cp ~horn/public_html/tc392/perl/w6.2.fdb temp.fdb 
# Usage:  w6.5.pl

undef($/);			#no boundaries; data read as 1 string
open (FH, "temp.fdb");
$contents = <FH>;
close (FH);

@records = split(/^Last:/m, $contents); 
shift(@records);
foreach (@records){
   $_ = "Last:" . $_; 				#Restore Last;
   m/Last: (.*)/;
   $last_name = $1;
   m/Food: (.*)/;
   $food = $1;
   print ("$last_name\'s food is $food.\n");
}
  
 
 
