- 論壇徽章:
- 12
|
While the grep is running, it shadows any existing value in $, which is to say that grep borrows the use of this variable but puts the original value back when it’s done. The variable $ isn’t a mere copy of the data item, though; it is an alias for the actual data element, similar to the control variable in a foreach loop.
當(dāng)grep工作的時(shí)候,它是從$變量中把值"借"出來(lái)用。就是說(shuō)grep把$_的值"借"過(guò)來(lái)用一下,用完后再把原值放回$_變量中。所以$_變量?jī)H僅是拷貝一下值而己。是實(shí)際數(shù)據(jù)元素的一個(gè)別名。就像foreach loop中的控制變量。
======================
這里應(yīng)該是翻譯錯(cuò)了。$_ 就是該變量本身,不是拷貝值。 |
|