1
#!/usr/bin/env perl2
use strict;
use warnings;
use 5.010;
use constant PI => 3.141592654;
my $radius = 12.5;
say 2 * PI * $radius;
#!/usr/bin/env perl3
use strict;
use warnings;
use 5.010;
use constant PI => 3.141592654;
say 'Input radius:';
chomp(my $radius = <STDIN>);
say 2 * PI * $radius;
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use constant PI => 3.141592654;
say 'Input radius:';
chomp(my $radius = <STDIN>);
my $circ = 2 * PI * $radius;
if($radius < 0){
$circ = 0;
}
say $circ;
4
#!/usr/bin/env perl5
use strict;
use warnings;
use 5.010;
say 'input one number:';
chomp(my $one = <STDIN>);
say 'input second number:';
chomp(my $second = <STDIN>);
my $result = $one * $second;
say "$one * $second = $result";
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
say 'input one string:';
chomp(my $string = <STDIN>);
say 'input repeat number:';
chomp(my $number = <STDIN>);
my $result = $string x $number;
say "result is $result";
Особо запомнилась конструкция вида:
chomp(my $radius = <STDIN>);
Комментариев нет:
Отправить комментарий