这个程序是正常的,你输入的abc只是代表一个数组元素,看我的,
192# perl 1.pl
Enter the list of strings:
a
b
c
cD
b
a
192# cat 1.pl
#!/usr/bin/perl -w
print "Enter the list of strings:\n";
@list = <STDIN>;
@reverselist = reverse @list;
print @reverselist;
192#
#!/usr/bin/perl -w
use strict;
print "Enter the list of string:\n";
my $a=0;
my $into;
my @test;
while ( $a<6) {
chomp($into=<>);
unshift(@test,"$into");
$a++ ;
}
print "@test\n" ;
#
my @reverse=reverse(@test);
print "@reverse\n ";
my @b;
@b=reverse("a","b","c","d");
print "@b\n";