Skip to content

Commit 1cfa2fd

Browse files
committed
perl学习代码
1 parent 8c3c3f0 commit 1cfa2fd

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

perl5/t/chapter2.pl

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/perl
2+
use strict;
3+
use warnings FATAL => 'all';
4+
5+
# print(!! 35 != 30 + 5);
6+
# print(!!35 == 35.0);
7+
# print(!!'35' eq '35.0');
8+
# print(!!'fred' lt 'fred');
9+
# print(!!'fred' lt 'barney');
10+
# print(!!'fred' eq 'fred');
11+
# print(!!'fred' eq 'Fred');
12+
# print(!!' ' eq '');
13+
14+
# my $food = <STDIN>;
15+
# my $betty = chomp $food;
16+
# print $betty;
17+
18+
print("请输入圆的半径:");
19+
my $r = <STDIN>;
20+
if ($r < 0) {
21+
print(0);
22+
exit(0)
23+
}
24+
print(2 * 3.141592654 * $r . "\n");
25+
26+
my $x = <STDIN>;
27+
my $y = <STDIN>;
28+
print("$x * $y\n");
29+
30+
my $str = <STDIN>;
31+
my $cnt = <STDIN>;
32+
print($str x $cnt . "\n");

perl5/t/chapter3.pl

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/perl
2+
use strict;
3+
use warnings FATAL => 'all';
4+

0 commit comments

Comments
 (0)