ellem has asked for the wisdom of the Perl Monks concerning the following question:
Any ideas?#! /usr/bin/perl -w use strict ; #Adress Book Program #ver .01 #Lou Moran 01.28.02 my ($cat, $fname, $lname, $cname, $addr1, $addr2, $city, $state, $zip, + $wphone, $mphone, $hphone, $ophone, $bday, $anni, $email, $icq, $not +es) ; open (ADDRESS, '>> addbook.txt') or die "Can't open file; $!" ; while (<ADDRESS>) { print "Is this a Personal or Business contact? (Enter P or B)" ; my $perbus = <STDIN> ; chomp $perbus ; $perbus =~ tr/A-Za-z/a-z/ ; if ($perbus eq 'b'){ $cat = "Business" ; } else { $cat = "Personal" ; } print "Enter a first name: " ; $fname = <STDIN> ; chomp $fname ; print "Enter a last name: " ; $lname = <STDIN> ; chomp $lname ; print "Enter a company name: " ; $cname = <STDIN> ; chomp $cname ; print "Enter address information: " ; $addr1 = <STDIN> ; chomp $addr1 ; print "Enter address information: " ; $addr2 = <STDIN> ; chomp $addr2 ; print "Enter city: " ; $city = <STDIN> ; chomp $city ; print "Enter state (Use 2 letter abbreviation): " ; $state = <STDIN> ; chomp $state ; print "Enter Zip code: " ; $zip = <STDIN> ; chomp $zip ; print "Enter work phone: " ; $wphone = <STDIN> ; chomp $wphone ; print "Enter mobile phone: " ; $mphone = <STDIN> ; chomp $mphone ; print "Enter home phone: " ; $hphone = <STDIN> ; chomp $hphone ; print "Enter other phone: " ; $ophone = <STDIN> ; chomp $ophone ; print "Enter a birthday: " ; $bday = <STDIN> ; chomp $bday ; print "Enter an anniversary: " ; $anni = <STDIN> ; chomp $anni ; print "Enter email address: " ; $email = <STDIN> ; chomp $email ; print "Enter ICQ or AIM name: " ; $icq = <STDIN> ; chomp $icq ; print "Enter a note about the entry: " ; $notes = <STDIN> ; chomp $notes ; write ADDRESS ; } close ADDRESS or die "Can't close file; $!" ; format ADDRESS_TOP = AddressBook version 0.01 ___________________ ______________________________________________ +________ . format ADDRESS = @<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<< "NAME", $lname, $fname "ADDRESS", $addr1 "ADDRESS", $addr2 "CITY", $city "STATE", $state "ZIP", $zip "WORK PHONE", $wphone "MOBILE PHONE", $mphone "HOME PHONE", $hphone "OTHER PHONE", $ophone "BIRTHDAY", $bday "ANNIVERSARY", $anni "EMAIL", $email "ICQ-AIM NAME", $icq "NOTE", $note "CATEGORY", $cat .
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why does this code quit?
by adamsj (Hermit) on Feb 01, 2002 at 08:12 UTC | |
by tachyon (Chancellor) on Feb 01, 2002 at 13:56 UTC | |
|
Re: Why does this code quit?
by busunsl (Vicar) on Feb 01, 2002 at 07:44 UTC | |
|
Re: Why does this code quit?
by japhy (Canon) on Feb 01, 2002 at 14:20 UTC | |
by ellem (Hermit) on Feb 01, 2002 at 14:32 UTC | |
by japhy (Canon) on Feb 01, 2002 at 14:43 UTC | |
|
Re: Why does this code quit?
by dmmiller2k (Chaplain) on Feb 01, 2002 at 19:11 UTC |