Interesting Error - Can't use string ("1909") as an ARRAY ref while "strict refs" in use

Julian Field MailScanner at ecs.soton.ac.uk
Sat Mar 7 18:07:33 GMT 2009



On 3/7/09 5:07 PM, Drew Marshall wrote:
> Rick
>
> On 7 Mar 2009, at 16:30, Rick Cooper wrote:
>
>> Been looking at this and really have no way to test because I don't use
>> postfix but try changing
>>
>>    while (${@{$body}}[scalar(@{$body})-1] !~ /^\s*$/) {
Doesn't scalar(@{$body})-1 need to be $#{@{$body}} or something like that?
As it needs to de-reference $body into an array, and then take $# of it?
$#body won't work as @body is not an array, @{$body} is the array.
>>      print "Line is ****" . ${@{$body}}[scalar(@{$body})-1] . "****\n";
>>      pop @{$body};
>>      #print STDERR ".";
>>    }
>>
>> TO
>>
>>    my $Bodyref = \@body;
>>
>>    while (${@{$body}}[$#Bodyref] !~ /^\s*$/) {
>>      print "Line is ****" . ${@{$body}}[$Bodyref] . "****\n";
>>      pop @{$#Bodyref};
>>      #print STDERR ".";
>>    }
>
> Note # removed.
>
> This produces:
>
> Global symbol "@body" requires explicit package name at 
> /usr/share/MailScanner//MailScanner/PFDiskStore.pm line 509.
> Global symbol "@Bodyref" requires explicit package name at 
> /usr/share/MailScanner//MailScanner/PFDiskStore.pm line 512.
> Global symbol "@Bodyref" requires explicit package name at 
> /usr/share/MailScanner//MailScanner/PFDiskStore.pm line 513.
> Compilation failed in require at /usr/sbin/MailScanner line 354.
>
>
> Drew

Jules

-- 
Julian Field MEng CITP CEng
www.MailScanner.info
Buy the MailScanner book at www.MailScanner.info/store

MailScanner customisation, or any advanced system administration help?
Contact me at Jules at Jules.FM

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
PGP public key: http://www.jules.fm/julesfm.asc


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the MailScanner mailing list