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 16:01:26 GMT 2009


Okay, try changing the line to these two lines:

     my $line = int(scalar(@{$body})-1;
     while (${@{$body}}[$line] !~ /^\s*$/) {

This really is a bug in Perl. Every variable has a string value and a 
numeric value, depending on context. So $a[1909] should equal 
$a["1909"]. But in this case it's using the string value, which it can't 
use, and not the numeric value, which it can.

On 3/7/09 11:57 AM, Drew Marshall wrote:
>
> On 6 Mar 2009, at 19:55, Julian Field wrote:
>
>> If it's complaining that int(1909) cannot be used as an array ref, 
>> then there's not a whole lot I can do.
>
> :-(
>
>> You could try changing the line to
>>   while (${@{$body}}[int(scalar(@{$body})-1)+0] !~ /^\s*$/) {
>> (i.e. add a "+0" to it) but there really isn't much more I can do.
>> Try the +0 and let me know if it helps at all.
>
> Can't use string ("18") as an ARRAY ref while "strict refs" in use at 
> /usr/share/MailScanner//MailScanner/PFDiskStore.pm line 509.
>
>> This is a nasty Perl bug.
>
> :-((
>
> Am I the only MailScanner user who has tried to get MS working on 
> Unbuntu 8.10 Server? If so, then it's broken and don't bother trying 
> it. If not, then my install is borked (Which at least is better as I 
> can fix that!).
>
> 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