P
perler wannabe
Hi,
Here is my script:
#!/usr/bin/perl
chomp(my @string = <STDIN>);
print "1234567890" x 6,"\n";
foreach (@string) {
printf "%20s\n";
}
This gives me the output I want which is: my strings reight-justified,
20 characters column as the following:
1234567890123456789012345678901234567890123456789012345678901234567890
perL
c++
javascript
but if I use printf instead of print in my script as the following:
printf "1234567890" x 6,"\n";
it will give me something like the following:
1234567890123456789012345678901234567890123456789012345678901234567890
perL
c++
javascript
what makes this distinct behavior?
Thanks
Here is my script:
#!/usr/bin/perl
chomp(my @string = <STDIN>);
print "1234567890" x 6,"\n";
foreach (@string) {
printf "%20s\n";
}
This gives me the output I want which is: my strings reight-justified,
20 characters column as the following:
1234567890123456789012345678901234567890123456789012345678901234567890
perL
c++
javascript
but if I use printf instead of print in my script as the following:
printf "1234567890" x 6,"\n";
it will give me something like the following:
1234567890123456789012345678901234567890123456789012345678901234567890
perL
c++
javascript
what makes this distinct behavior?
Thanks