#!/usr/bin/perl -w use v5.; @array = split "", shift @ARGV;
@array_1 = @array[..($#array+1)/2-1];
@array_2 = reverse @array[($#array+2)/2..$#array]; print "Array: @array\n";
print "@array_1\n";
print "@array_2\n";
就是有一点,下标不好算!
2023-08-07 18:57:16
#!/usr/bin/perl -w use v5.; @array = split "", shift @ARGV;
@array_1 = @array[..($#array+1)/2-1];
@array_2 = reverse @array[($#array+2)/2..$#array]; print "Array: @array\n";
print "@array_1\n";
print "@array_2\n";
就是有一点,下标不好算!