open(IN,"list.txt");
while($line=<IN>){
($fname,$lname,$email)=split /""/, $line;
#database code omitted
}
close (IN);
what happens is the the value in $line is placed in $fname and $lname and $email are left null
any help is appreciated
open(IN,"list.txt") or die"$!";
while(my $line=<IN>){
my ($fname,$lname,$email)= split(/\s/,$line);
#database code omitted
}
close (IN);
which can be written more succinctly:
open(IN,"list.txt") or die "$!";
while(<IN>){
my ($fname,$lname,$email)= split(/\s/);
#database code omitted
}
close (IN);
make sure you start using "strict" with your perl scripts too and declaring your variables with "my".