문제

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.

http://www.perlmonks.org/?node_id=24640

도움이 되었습니까?

해결책

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.

다른 팁

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 $_.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top