Skip to content

Commit

Permalink
perl学习代码
Browse files Browse the repository at this point in the history
  • Loading branch information
zenvzenv committed May 17, 2022
1 parent 0cbe25e commit de53b34
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
32 changes: 32 additions & 0 deletions perl5/t/chapter2.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';

# print(!! 35 != 30 + 5);
# print(!!35 == 35.0);
# print(!!'35' eq '35.0');
# print(!!'fred' lt 'fred');
# print(!!'fred' lt 'barney');
# print(!!'fred' eq 'fred');
# print(!!'fred' eq 'Fred');
# print(!!' ' eq '');

# my $food = <STDIN>;
# my $betty = chomp $food;
# print $betty;

print("请输入圆的半径:");
my $r = <STDIN>;
if ($r < 0) {
print(0);
exit(0)
}
print(2 * 3.141592654 * $r . "\n");

my $x = <STDIN>;
my $y = <STDIN>;
print("$x * $y\n");

my $str = <STDIN>;
my $cnt = <STDIN>;
print($str x $cnt . "\n");
4 changes: 4 additions & 0 deletions perl5/t/chapter3.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';

0 comments on commit de53b34

Please sign in to comment.