in reply to Re^2: Weird grep behaviour
in thread Weird grep behaviour

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^4: Weird grep behaviour
by shmem (Chancellor) on Oct 18, 2007 at 09:21 UTC
    Iterating over (a,b) setting $var1 to each, $var1 is 'b' at the second iteration. @arr1 only contains (a). How does 'b' match 'a' ? It doesn't. First, 'a' is true, so 'a' from @arr1 is returned; next 'b' is true, so 'a' from @arr1 is returned. There is no match; grep doesn't implicitly wrap its first argument into a m// operator.