Thread Seriennummer (Buchstaben) hochzählen
(7 answers)
Opened by Gustl at 2014-01-27 14:27
perl macht das für dich =)
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 sub get_new_numbers { my ($num, $string) = @_; my ($mat, $last5) = $string =~ m/^(\w*)(\w{5})$/ or die "doesn't match"; my @numbers; for (1 .. $num) { push @numbers, $mat . ++$last5; # automagie } return @numbers; } Last edited: 2014-01-27 14:50:43 +0100 (CET) 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: Wie frage ich & perlintro brian's Leitfaden für jedes Perl-Problem |