However my little test program has come to a slight halt...
It gathers information from the user and when done puts the information into a file. Here is my code...
CODE
#!/usr/bin/perl
$fname = &getfname;
$lname = &getlname;
$bday = &getbday;
$interest = &getinterest;
$connection = &getconnection;
$alldone = "n Name: $lname, $fnamen Birthday: $bdayn Interests: $interestn Connection Type: $connectionn";
sub getfname {
print "First Name: ";
$fname = <>;
chop($fname);
$fname;
}
sub getlname {
print "Last name: ";
$getlname = <>;
chop($getlname);
$getlname;
}
sub getbday {
print "Birthday (January 01, 1985): ";
$bday = <>;
chop($bday);
$bday;
}
sub getinterest {
print "List a few interests: ";
$interest = <>;
chop($interest);
$interest;
}
sub getconnection {
print "Connection Type: ";
$connection = <>;
chop($connection);
$connection;
}
print $alldone;
open(OUT, ">peoplelist.dat");
print(OUT $alldone);
$fname = &getfname;
$lname = &getlname;
$bday = &getbday;
$interest = &getinterest;
$connection = &getconnection;
$alldone = "n Name: $lname, $fnamen Birthday: $bdayn Interests: $interestn Connection Type: $connectionn";
sub getfname {
print "First Name: ";
$fname = <>;
chop($fname);
$fname;
}
sub getlname {
print "Last name: ";
$getlname = <>;
chop($getlname);
$getlname;
}
sub getbday {
print "Birthday (January 01, 1985): ";
$bday = <>;
chop($bday);
$bday;
}
sub getinterest {
print "List a few interests: ";
$interest = <>;
chop($interest);
$interest;
}
sub getconnection {
print "Connection Type: ";
$connection = <>;
chop($connection);
$connection;
}
print $alldone;
open(OUT, ">peoplelist.dat");
print(OUT $alldone);
I've tested this on my FreeBSD shell and it works...kinda. The peoplelist.dat is created except if the program is run again, the list is restarted. So...
How can I make my code here add ONTO the list, instead of overwriting it everytime?