in reply to same code,run at windows and unix separately,the result is different

This error that would have been prevented by use strict; use warnings;

I bet your Windows version is 5.10 and your unix version predates 5.10.

>c:\progs\perl588\bin\perl -l 770193.pl 42 >c:\progs\perl589\bin\perl -l 770193.pl 42 >c:\progs\perl5100\bin\perl -l 770193.pl 00

Before 5.10, a bug caused the "@" in "$#{@a}" to be ignored. It was fixed in 5.10.0.

Fixed:

#!/usr/bin/perl use strict; use warnings; my @a = (9, 2, 3, 4); my @b = ("a", "b"); func(\@a, \@b); sub func { my ($c, $d) = @_; print $#{$c}+1, $#{$d}+1, "\n"; #print $#$c+1, $#$d+1, "\n"; \ #print 0+@{$c}, 0+@{$d}, "\n"; > Alternatives #print 0+@$c, 0+@$d, "\n"; / }

See Dereferencing Syntax.

Update: Added alternatives and link.
Update: Added results of various version.