Ian.H wrote:
(snipped)
> my $scan_results = `$scan_command $scan_path`;
> $scan_results =~ s#.*Switches: -ARCHIVE -PACKED
> -COLLECT\n\n(.*)\n\nResults of virus scanning:.*#$1#s;
> if (m#^$scan_path(.*?)->(.*)\s+Infection:\s+(.*)$#) {
> ($user,$attachment, $infection) = ($1, $2, $3);
> Use of uninitialized value in pattern match (m//) at ./mail_scan.pl line 13
You are trying to use Perl's $_ but it does not exist, for your context.
if (m#^$scan_path ....
if ($scan_results =~ m#^$scan_path ....
It is a good practice to always use explicit variable names
even when $_ is used invisibly. You have fallen into this
pitfall of thinking $_ is there, is defined. It is not.
...
Bookmarks