请教一个问题?

请教一个问题?

请教一个问题?
第一个程序如下:
#!/usr/bin/perl -w


use strict;
my @i = ('1', '2', '3');
my @j = ('a', 'b', 'c');
print "In main program before calling subroutine: i = " ."@i\n";
print "In main program before calling subroutine: j = " ."@j\n";

reference_sub(@i, @j);
print "In main program after calling subroutine: i = " ."@i\n";
print "In main program after calling subroutine: j = " ."@j\n";
exit;


sub reference_sub {
my(@i, @j) = @_;
print "In subroutine : i = " . "@i\n";
print "In subroutine : j = " . "@j\n";
push(@i, '4');
shift(@j);
}


结果:
In main program before calling subroutine: i = 1 2 3
In main program before calling subroutine: j = a b c
In subroutine : i = 1 2 3 a b c
In subroutine : j =
In main program after calling subroutine: i = 1 2 3
In main program after calling subroutine: j = a b c


第二个程序如下:
#!/usr/bin/perl


use strict;
use warnings;
my @i = ('1', '2', '3');
my @j = ('a', 'b', 'c');
print "In main program before calling subroutine: i = " ."@i\n";
print "In main program before calling subroutine: j = " ."@j\n";

reference_sub(\@i, \@j);
print "In main program after calling subroutine: i = " ."@i\n";
print "In main program after calling subroutine: j = " ."@j\n";
exit;


sub reference_sub {
my($i, $j) = @_;
print "In subroutine : i = " . "@$i\n";
print "In subroutine : j = " . "@$j\n";
push(@$i, '4');
shift(@$j);
}

结果:
In main program before calling subroutine: i = 1 2 3
In main program before calling subroutine: j = a b c
In subroutine : i = 1 2 3
In subroutine : j = a b c
In main program after calling subroutine: i = 1 2 3 4
In main program after calling subroutine: j = b c


我现在不能理解的是子程序中的这两句:

push(@$i, '4');
shift(@$j);

为何在第一个程序中这两句(当然在第一个程序中使用的push(@i, '4');和shift(@j);)不起作用,而第二个中起到了作用,并烦劳大家讲解一个这两句在程序中的意思,尽管单独列出这两句我能理解,但是在这两个程序中我却不理解了!!
谢谢!!
问题出在 reference_sub(@.
问题出在 reference_sub(@i, @j); 与 my(@i, @j) = @_;
当传递参数时,reference_sub(@i, @j) 等价与 reference_sub('1', '2', '3', 'a', 'b', 'c'); 以至于在接收端赋值 my(@i, @j) = @_;的结果中 @_的全部元素都赋予@i, 此时在reference_sub中@j为空列表
第一个程序采取的是传值,第二个是引用的方式,所以第二个程序在reference_sub内容对$i与$j所做的修改会影响到原来的列表
楼上讲的完全没错,关键是.
楼上讲的完全没错,关键是传值和传引用的区别