#!/usr/bin/perl
use strict;
use warnings;
my @matrix;
foreach my $i(0..10){
for(my $j=0;$j<10;$j++){
$matrix[$i][$j]=$i*$j;
print $matrix[$i][$j]," ";
}
print "\n";
}
위와 같이 배열로 선언후 첨자를 다중으로 사용이 가능하다.
#!/usr/bin/perl
use strict;
use warnings;
my @matrix;
foreach my $i(0..10){
for(my $j=0;$j<10;$j++){
$matrix[$i][$j]=$i*$j;
=comment
print $matrix[$i][$j]," ";
=cut
}
print "\n";
}
=comment
=cut
사이가 주석이 된다.
=comment 는 다중 주석의 시작부분이다. =뒤에 어떠한 단어도 사용할수 있으며 소문자로만 시작하면 된다.
다중 주석의 종료는 =cut 이다.
한줄 주석은 #으로 시작한다.