Die schnellste Lösung dafür ist: my @nums = $str =~ /(..)/g;
hallo,
stimmt, sogar mit abstand
#!/usr/bin/perl no strict; no warnings; use Benchmark qw(cmpthese); my $string='EE6Hg36dgebe7253jkabad7823'; cmpthese( -1, { a => sub{my @erg = grep { !/^$/ } split(/(..)/, $string)}, b => sub{my @nums = $string =~ /(..)/g}, c => sub{$string=~s/([^\ ].?)/$1\ /gi;}} );
DATA_ Rate c a b c 350/s -- -95% -98% a 7456/s 2028% -- -64% b 20676/s 5802% 177% --
gruss
--
no strict; no warnings;
no strict; no warnings;