Hello Everyone!
New member here and I have posted code below. The question is how do I go about editing on one screen not on several as it is being done in the code below which is a subroutine part of a larger script:
What I would like is to Enter the Owner on one screen and the next screen would list the cars owned by the owner and then highlight/select a car and the next screen would be the edit screen. Thanks for the help!
New member here and I have posted code below. The question is how do I go about editing on one screen not on several as it is being done in the code below which is a subroutine part of a larger script:
Code:
sub editcar {
Title "Edit A Car";
print("==============\n\n");
print("| MAKE: |\n\n");
print(" ==============\n\n\n\n\n\n\n\n\n\n\n\n");
my $origMake = <STDIN>;
$origMake = <STDIN> until defined $origMake;
chomp $origMake;
cls();
print("================\n\n");
print("| MODEL: |\n\n");
print(" ================\n\n\n\n\n\n\n\n\n\n\n\n");
my $origModel = <STDIN>;
$origModel = <STDIN> until defined $origModel;
chomp $origModel;
cls();
print(" ==================================\n\n");
print("| YEAR : |\n\n");
print(" ==================================\n\n\n\n\n\n\n\n\n\n\n\n");
my $origYear = <STDIN>;
$origYear = <STDIN> until defined $origYear;
chomp $origYear;
cls();
print(" =============================\n\n");
print("| NEW OWNER: |\n\n");
print(" =============================\n\n\n\n\n\n\n\n\n\n\n\n");
my $newOwner = <STDIN>;
$newOwner = <STDIN> until defined $newOwner;
chomp $newOwner;
cls();
my $file = "cardata.txt";
local $^I = ".bak";
local @ARGV = ($file);
while (<>) {
chomp;
my ($Make,$Model,$Year,$Owner) = split(/\:/);
if (($Make eq $origMake) && ($Model == $origModel)) {
print "$Make:$Model:$Year:$newOwner\n";
}
else {
print "$_\n";
}
}
unlink("$file.bak");
print("\n\n\n\n\n\n\n\n");
print("CAR UPDATED SUCCESSFULLY!!\n\n\n\n\n\n\n\n\n\n\n\n");
} # END UPDATE CAR
Comment