Leser: 23
$string =~ s/(.{1,$n})/$1\n/g;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
my $string1="hallohallohallo";
my $string2="hannahannahanna";
my @array1;
my @array2;
push(@array1,$string1);
push(@array2,$string2);
my $count=0;
for my $i (0..$#array1){
if($i % 5 == 0){
for my $j($count..$i){
print $array1[$j]."\n";
print $array2[$j]."\n";
}
$count=$i;
}
}
1 2 3 4 5 6 7 8 9
my @s = qw/ hallohallohallO hannahannahannA /; for (@s) { $_ = [m/(.{1,5})/g]; } for my $i (0 .. $#{ $s[0] }) { for (@s) { print "$_->[$i]\n"; } }
2010-03-08T13:43:18 pqklar.
Code (perl): (dl )$string =~ s/(.{1,$n})/$1\n/g;
1 2 3 4 5
my $string = "hallohallohallo"; my $x = 5; $string =~ s/(.{$x})/$1\n/g; print $string;