$ vim var1.pl
:syntax on
a
use strict;
use warnings;
#\を$の前に置けば、変数が展開されない。
my $price = 10000;
print "$price is $price\n";
print "\$price is $price\n";
#四則演算をして結果を表示させてみた。
my $add = 12 + 3;
my $sub = 12 - 3;
my $mul = 12 * 3;
my $div = 12 / 3;
print "\$add = $add\n";
print "\$sub = $sub\n";
print "\$mul = $mul\n";
print "\$div = $div\n";
#浮動小数の扱い
my $mul = 365/7;
print "$mul\n";
print int("$mul\n");
perl -cw var1.pl
"my" variable $mul masks earlier declaration in same scope at var1.pl line 26.
10000 is 10000
$price is 10000
$add = 15
$sub = 9
$mul = 36
$div = 4
52.1428571428571
52