By default, matching, substitution, or transliteration act on $_
; to use them on another variable, the binding operator =~
is used. In your case, the variable the substitution will be performed on is $xmlfile
.
What is perl symbol =~ [duplicate]
سؤال
I am using someone else's text parsing perl code and I'd like to make some modifications. Could someone explain what =~ symbol is doing?
$xmlfile =~ s/value="{(.*?)}"/'value="'.&subst($1).'"'/ge;
EDIT:
So I found this thread that explains part of the regex string.
المحلول
نصائح أخرى
According to perlop
:
Binary "=~" binds a scalar expression to a pattern match. Certain operations search or modify the string $_ by default. This operator makes that kind of operation work on some other string. The right argument is a search pattern, substitution, or transliteration. The left argument is what is supposed to be searched, substituted, or transliterated instead of the default $_.
لا تنتمي إلى StackOverflow