一:
print "@array\n";
二:
for $row (@array) {
print "@$row\n";
}
三:
for $row (0..$#array) {
print "row $row is: @{$geno_sample[$row]}\n";
}
Perl 中输出 hash 的全部內容, 有以下几种方法:
- while(my ($key, $val) = each(%hash)) { print "$key $val" }
- %hash = qw / car 600k bike 70k /; print $_ , $hash{$_} , "\n" foreach (keys %hash);
- print "$_ $hash{$_}\n" foreach (keys %hash);
- print "$_ $h{$_}\n" for keys %h;
Perl 中输出 Array 的內容:
- print $_."\n" for @a;
- print @a;
- push @a, split for <>; print @a;
阅读(3602) | 评论(0) | 转发(0) |