-
Notifications
You must be signed in to change notification settings - Fork 0
/
scalar.pl
66 lines (46 loc) · 1.08 KB
/
scalar.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/perl
$age = 23;
$name = "tony";
$salary = 123.09;
print "$age = $age\n";
print "$name = $name\n";
print "$salary = $salary\n";
$integer = 200;
$negative = -300;
$floating = 200.400;
$bigfloat = -2.2E-23;
$octal = 0377;
$hexa = 0xff;
print "integer = $integer\n";
print "negative = $negative\n";
print "floating = $floating\n";
print "bigfloat = $bigfloat\n";
print "octal = $octal\n";
print "hexa = $hexa\n";
$var = "字符串标量 -菜鸟教程";
$quote = '我在单引号内-$var';
$double = "我在双引号内-$var";
$escape = "转义字符串使用 -tHello,world!";
print "var = $var\n";
print "quote = $quote\n";
print "double = $double\n";
print "escape = $escape\n";
$str = "hello" . "world";
$num = 2 + 3;
$mul = 4 * 5;
$mix = $str . $num;
print "str = $str\n";
print "num = $num\n";
print "mix = $mix\n";
$string = '
上海欢迎你吗
-- 上海人
';
print "string = $string\n";
print <<EOF
学习技术,
--实现梦想
EOF
#print "文件名: " . __FILE__ . "\n";
#print "行号: " . __LINE__ . "\n";
#print "包名:" . __PACKAGE__ . "\n";