正規表現$1,$2,$3...

evalしたときの$@とは違い、マッチしたごとに上書きはされないので注意!

my $date;

$date = '2010-10-13';
$date =~ m/^(\d{4})-(\d{2})-(\d{2})$/;
print join(q{,}, $1,$2,$3), "\n";

$date = undef;
$date =~ m/^(\d{4})-(\d{2})-(\d{2})$/;
print join(q{,}, $1,$2,$3), "\n";

__END__
2010,10,13
2010,10,13