5 Einträge, 1 Seite |
1
2
3
my $string = "EMARTQKNKATSAHLGLLKANVAKLRRELISPKGG";
my @array = ( $string =~ m/(.{5})/g );
print join "\n", @array;
my @array = $string =~ m/(.{1,5})/g;
1 2 3 4 5 6 7 8 9 10
my $chars = 5; my $length = length($string); my $parts = $length / $chars; my $pattern = "A$chars " x int($parts); if ($parts ne int($parts)) { # rest geblieben => noch ein A* ans ende packen $pattern .= "A*"; } my @strings = unpack($pattern, $string);
1
2
3
my $chars = 5;
my $pattern = "A$chars " x int(length($string) / $chars) . "A*";
my @strings = unpack($pattern, $string);
5 Einträge, 1 Seite |