Thread Split in Gruppen (9 answers)
Opened by MarkusH at 2014-05-31 13:17

pq
 2014-06-01 22:48
#175876 #175876
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
nix verhaspeln ;-)

verwendet man klammern, wird gecaptured, und in dem fall bekommt man die captures als zusätzliches ergebnis.

Quote
If the PATTERN contains parentheses, additional list elements are created from each matching substring in the delimiter.


Code: (dl )
1
2
3
4
5
6
7
8
9
perl -wE'
my $string = "abc:def:ghi";
my @array = split /(:)/, $string;
say for @array'
abc
:
def
:
ghi
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Split in Gruppen