- 论坛徽章:
- 0
|
回复 #14 gaochong 的帖子
自我参考:
Since the diamond operator is generally used to process all of the input, it's typically a mistake to use it in more than one place in your program. If you find yourself putting two diamonds into the same program, especially using the second diamond inside the while loop that is reading from the first one, it's almost certainly not going to do what you want. In our experience, when beginners put a second diamond into a program, they meant to use $_ instead. Remember, the diamond operator reads the input, but the input itself is generally found in $_ (by default).
If you re-initialize @ARGV before using the second diamond, then you're on solid ground. We'll see @ARGV in the next section. |
|