- or download this
sub addbuddy {
#add victim to buddy list
#open names file
open (FILE, "names.txt");
- or download this
$list = <FILE>;
- or download this
close(DATA);
#checks each name
foreach $item (@list) {
- or download this
#remove lowercase and spaces from names
$item =~ s/ //g;
$item = lc ($item);
- or download this
}
#check if name is in file
if ($victim eq "$item") {
- or download this
}
else {
#if it does not exits add it
open (DATA, ">names.txt");
- or download this
print DATA "$victim\n";
Close (DATA);
- or download this
}
#Notify the terminal
print "A Buddy name was added..";
}