Thread Nach Muster suchen (11 answers)
Opened by Rambo at 2009-08-18 15:33

renee
 2009-08-18 15:47
#124351 #124351
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
$^N ist eine Spezialvariable
Quote
# $LAST_SUBMATCH_RESULT
# $^N

The text matched by the used group most-recently closed (i.e. the group with the rightmost closing parenthesis) of the last successful search pattern. (Mnemonic: the (possibly) Nested parenthesis that most recently closed.)

This is primarily used inside (?{...}) blocks for examining text recently matched. For example, to effectively capture text to a variable (in addition to $1 , $2 , etc.), replace (...) with

1. (?:(...)(?{ $var = $^N }))

By setting and then using $var in this way relieves you from having to worry about exactly which numbered set of parentheses they are.

This variable is dynamically scoped to the current BLOCK.


Du solltest besser so etwas machen:
Code (perl): (dl )
1
2
3
if ($line =~/S\/R Sending command\r?\n-+\r?\nNRT CC\/(\d+)/) {
    print $1;
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Nach Muster suchen