寒假【perl语言学习脚本】2.1,2.2,2.3,2.4,2.5

突然发现****的代码直接复制粘贴会缺失$这个符号在开头
还自动放大和缩小一些字符,很难看阿
直接截图吧,有点难受这样,看着不太对

############################################
#ex2-1.pl
#!/usr/bin/perl
use warnings;
$pi=3.141592654;
circ=2circ=2*pi*12.5;
print “the circumference of a circle of radius 12.5 is $circ.\n”;
寒假【perl语言学习脚本】2.1,2.2,2.3,2.4,2.5

############################################
#ex2-2.pl
#!/usr/bin/perl
use warnings;
print “what is the radius?”;
chomp($radius=);
$pi=3.141592654;
circ=2circ=2*pi*$radius;
print “the circumference of a circle of radius 12.5 is $circ.\n”;
寒假【perl语言学习脚本】2.1,2.2,2.3,2.4,2.5

############################################
#ex2-3.pl
#!/usr/bin/perl
use warnings;
print “what is the radius?”;
chomp($radius=);
$pi=3.141592654;
circ=2circ=2*pi*radius;if(radius; if(radius<0){
$circ=0;
}
print “the circumference of a circle of radius 12.5 is $circ.\n”;

寒假【perl语言学习脚本】2.1,2.2,2.3,2.4,2.5
############################################
#ex2-4.pl
#!/usr/bin/perl -w
print “enter first number:”;
chomp(one=&lt;STDIN&gt;);print&quot;entersecondnumber:&quot;;chomp(one=&lt;STDIN&gt;); print &quot;enter second number:&quot;; chomp(two=);
result=result=one*$two;
print “the result is $result.\n”;

寒假【perl语言学习脚本】2.1,2.2,2.3,2.4,2.5
############################################

#ex2-5.pl
#!/usr/bin/perl
use warnings;
print “enter a string:”;
str=&lt;STDIN&gt;;print&quot;enteranumberoftimes:&quot;;chomp(str=&lt;STDIN&gt;; print &quot;enter a number of times:&quot;; chomp(num=);
result=result=str x KaTeX parse error: Expected 'EOF', got '\n' at position 27: …"the result is:\̲n̲result ";
寒假【perl语言学习脚本】2.1,2.2,2.3,2.4,2.5