P
perl
Ok, thanks for the helpful responses from my last post. I modified the
code with 2 different suggestions. I'm not using strict. Any ideas?
With this code.. %emails = map { chomp; $_, 1 } <$list>;
I get this error
Can't modify concatenation (.) or string in scalar assignment at
email.cgi line 535, near "<$list>;"
With this code: $emails{lc $_} = 1 if ! exists $emails{lc $_};
I get this error
Can't modify concatenation (.) or string in scalar assignment at
email.cgi line 534, near "1 if"
Here is the whole routine...
my $list2 = "$userpath/files/$list";
my %emails;
open(my $list, '<', $list2)
or error("Open failed $list2 $!");
while (<$list>) {
chomp if defined;
next if /^\s*$/;
$emails{lc $_} = 1 if ! exists $emails{lc $_};
#%emails = map { chomp; $_, 1 } <$list>;
}
close($list) or warn $!;
code with 2 different suggestions. I'm not using strict. Any ideas?
With this code.. %emails = map { chomp; $_, 1 } <$list>;
I get this error
Can't modify concatenation (.) or string in scalar assignment at
email.cgi line 535, near "<$list>;"
With this code: $emails{lc $_} = 1 if ! exists $emails{lc $_};
I get this error
Can't modify concatenation (.) or string in scalar assignment at
email.cgi line 534, near "1 if"
Here is the whole routine...
my $list2 = "$userpath/files/$list";
my %emails;
open(my $list, '<', $list2)
or error("Open failed $list2 $!");
while (<$list>) {
chomp if defined;
next if /^\s*$/;
$emails{lc $_} = 1 if ! exists $emails{lc $_};
#%emails = map { chomp; $_, 1 } <$list>;
}
close($list) or warn $!;