YAPE::Regex::Expression ist immer ganz gut, wenn man sich RegExes erklären lassen will:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
The regular expression:
(?-imsx:.*?(\d+)$)
matches as follows:
NODE EXPLANATION
----------------------------------------------------------------------
(?-imsx: group, but do not capture (case-sensitive)
(with ^ and $ matching normally) (with . not
matching \n) (matching whitespace and #
normally):
----------------------------------------------------------------------
.*? any character except \n (0 or more times
(matching the least amount possible))
----------------------------------------------------------------------
( group and capture to \1:
----------------------------------------------------------------------
\d+ digits (0-9) (1 or more times (matching
the most amount possible))
----------------------------------------------------------------------
) end of \1
----------------------------------------------------------------------
$ before an optional \n, and the end of the
string
----------------------------------------------------------------------
) end of grouping
----------------------------------------------------------------------
Außerdem solltest Du die substitution auf ein einzelnes Element machen, denn
warnings gibt Dir folgende Meldung:
Applying substitution (s///) to @array will act on scalar(@array) at skript.pl line 9.
Mehr zu dem was
s/// macht findest Du in
perlop.
Was
$1 ist, wird in
perlvar erklärt.