
kskim02
New User
Aug 13, 2012, 6:13 AM
Post #1 of 6
(824 views)
|
I'm trying to create a program that allows a user to create customer information that is written to a separate text file. I want to assign a unique customer ID to each customer so that I can modify or delete a customer using their ID when necessary. Here is what I have so far, any help would be greatly appreciated: #This program allows you to add, change, or delete customer information open (MYFILE, '>>test.txt'); $Test = 'test.txt'; open(INDB, $Test) or die "the database could not be found \n"; $count = 0; while (1){ print "\nAdd(a),Change(c),Delete(d), or Quit(q): "; $input = <STDIN>; if($input=~/a/){ print "\nInput First Name: "; $FirstName = <STDIN>; chomp($FirstName); print "\nInput Last Name: "; $LastName = <STDIN>; chomp($LastName); print "\nInput Social Security Number: "; $SSNO = <STDIN>; chomp($SSNO); print "\nInput Address 1: "; $Add1 = <STDIN>; chomp($Add1); print "\nInput Address 2: "; $Add2 = <STDIN>; chomp($Add2); print "\nInput City: "; $City = <STDIN>; chomp($City); print "\nInput Zipcode: "; $Zip = <STDIN>; chomp($Zip); print "\nInput State: "; $State = <STDIN>; chomp($State); @info = ($FirstName,$LastName,$SSNO,$Add1,$Add2,$City,$Zip,$State,$count); print MYFILE "$LastName, $FirstName, $SSNO, $Add1, $Add2, $City, $Zip, $State, $count\n"; } if($input=~/c/) { print "\nWhat member # would you like to change?: "; $Memberchange = <STDIN>; chomp($Memberchange); seek(MYFILE, 0, 0); if ($Memberchange = $count){ print "ABCD";} } if($input=~/d/) { print "\nWhat member # would you like to delete?: "; $Memberdelete = <STDIN>; chomp($Memberdelete); } if($input=~/q/){ exit 0; } $count++; } close (MYFILE); exit 1;
|