This program display a names. If the name you type match the one asked to type, the program tells you the phone number of the name. The problem is it only list the last name in the file. How to get the program to start at the first name in the file, and after you type it correct, show name number and move to the next name? All help would be graceful!!
Code:
open (FILE, "profile.txt") || die "Can't open File.txt: $!\n";
@raw_data=<FILE>;
close(FILE);
# my array only loads last name in file
foreach $_ (@raw_data) #foreach loop to grab wanted variables
{
($c_name, $descript_info)=split(/\|/, $_); #split method create pipe used escaped with \ char two variables one for the names other for numbers
}
sub go{
$user= "Please type the name $c_name \n";}
MainLoop;
sub enter{
if ($E) #check user input value
{ goto contin1;}
else
{$user= "You didn't type anything!!\n";
}
contin1:
$user= "\e[H\e[J"; #clear the screen
if ( $c_name =~ /$E/ ) #compare with user input
{
$user="The name -$c_name to $desricpt_info \n";
my $mw_next=$main->messageBox(-message => "Remember!",-=>\&go, -type =>$user);
}
else
{
$user= "The name was mistyped! Please try again.\n";
}
Comment