Posted on Netease blog 21:18:43
Start learning Perl.
(What interests me about Perl is the little alpaca book. Er, this is the alpaca, but how does it feel like a god beast on the Internet .)
2.1-2.3 Calculation of circle radius
#! Perl-W
$ Pi = 3.141592654;
Print "Enter the semidiameter :";
$ Semidiameter = <stdin>;
Chomp ($ semidiameter );
If ($ semidiameter <0 ){
$ Semidiameter = 0;
}
$ Circumference = 2 * $ pI * $ semidiameter;
Print "circumference is $ circumference ";
2.4 calculate the product of two numbers
#! Perl-W
Print "Enter the first number ():";
Chomp ($ A = <stdin> );
Print "enter the second number (B ):";
Chomp ($ B = <stdin> );
$ C = $ A * $ B;
Print "a * B is $ C ";
2.5 print a string for a certain number of times
#! Perl-W
Print "Enter the character to print :";
Chomp ($ string_to_print = <stdin> );
Print "Enter times to print :";
Chomp ($ times = <stdin> );
$ Result =$ {string_to_print} x $ times;
Print "result is: $ result ";
Thanks for your encouragement. Someone will reply to me after posting this article on Netease blog.