Leser: 21
1
2
3
4
5
6
for(my $i = 1; $i <= length($rest); $i= $i+60){
for(my $j = 60; $i <= length($rest); $j= $j+60){
print substr($rest,$i,$j)."\n";
}
}
print join "\n", $string =~ /(.{1,60})/g; #edit: bösen fehler entfernt {60} => {1,60}
1 2 3 4 5 6
for ( my $i = 0; $i < length($string); $i += 60 ) { print substr($string, $i, 60), "\n"; } # for # oder: (edit) print join "\n", map substr($string,$_*60,60), 0 .. length($string) / 60;
1 2 3 4 5 6 7
my $string = 'a' x 150; my $max = 60; while( $string ) { print substr( $string, 0, $max ), "\n"; $string = substr $string, $max; }
perldoc perlform