Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chapter 5 (now running with input)
  • Loading branch information
Napier-JP committed Oct 14, 2018
1 parent 44c9ab8 commit 1185993
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ex5-2-correct.pl
@@ -0,0 +1,12 @@
#!perl
use strict;
use warnings;
use utf8;

chomp(my @input = <STDIN>);

print "1234567890123456789012345678901234567890\n"; #目盛り

foreach my $line (@input){
printf "%20s\n", $line;
}
13 changes: 13 additions & 0 deletions ex5-3-correct.pl
@@ -0,0 +1,13 @@
#!perl
use strict;
use warnings;
use utf8;

chomp(my @input = <STDIN>);
my $width = shift(@input);

print "1234567890" x (($width+9)/10), "\n"; #目盛り

foreach my $line (@input){
printf "%${width}s\n", $line;
}

0 comments on commit 1185993

Please sign in to comment.