#!/usr/bin/perl
use strict;
use warnings;
my @array = (
[1,2,3,4],
[5,6,7,8]
);
my @second_row = @{ $array[1] };
print "Second row: [@second_row]\n";
输出为:第二行:[5 6 7 8]
但我需要它:第二行:[5,6,7,8]
答案 0 :(得分:4)
你想要的是the join
function。尝试类似:
print "Second row: [", join(', ', @second_row), "]\n";