Good Morning Esteemed Monks!
What I would like is a pure perl solution in splitting the screen as shown in the code below. Top of the screen shows all the information and at the bottom of the screen is where new values can be entered. I would like the top screen to be shown all the time and the bottom screen changes for each input that needs to be changed. In this case the only value that needs changed is Owner. Thanks in advance.
#!/usr/bin/perl use strict; use warnings; use diagnostics; use Win32::Console::ANSI; use Win32::Console; use Term::ANSIColor; use Term::ANSIScreen qw/:cursor :screen/; ################### # # TEST ONLY # ################### Title "Edit Car"; open(MYINPUTFILE, "cardata.txt"); # open for input $| = 1; my @lines = <MYINPUTFILE>; # read file into list close (MYINPUTFILE); printf ("|VERIFY CAR OWNER|\n\n"); my $carownerverify = <STDIN>; $carownerverify = <STDIN> until defined $carownerverify; chomp($carownerverify); cls(); printf ("| OWNER | MAKE | MODEL | YEAR |\n\n"); my $found = 0; foreach my $carownerverify2 (@lines) { my @field = split(':',$carownerverify2); if ($field[0] =~ /(?<![\w-])$carownerverify(?![\w-])/i) { my $format = " %-13s %-15s %-11s %0s\n"; printf ($format, $field[0], $field[1], $field[2], $field[3]); $found =1; } } # END FILE LOOP ######################################### # # THE ABOVE STAYS ON TOP OF THE SCREEN # THE BELOW IS WHAT CHANGES # ######################################### print("| OWNER: |\n\n"); my $origOwner = <STDIN>; $origOwner = <STDIN> until defined $origOwner; chomp $origOwner; cls(); print("| NEW OWNER: |\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 ($Owner,$Make,$Model,$Year) = split(/\:/); if ($Owner eq $origOwner) { print "$Owner:$Make:$Model:$Year:$newOwner\n"; } else { print "$_\n"; } } unlink("$file.bak"); #close $file; print("CAR UPDATED SUCCESSFULLY!!\n\n"); sleep 10;
In reply to Pure Perl Split Screen by PilotinControl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |