in reply to Re^2: Joining an array
in thread Joining an array
Update: What happens is that the main package is (ab)used as a class implementing a tied scalar for $". Whenever perl wants to use the value of the tied scalar $", it calls the object method FETCH instead, in this case, main::FETCH. And that method returns either "=" or "&", depending on how often it was called before. The modulo operator % switches between the two values with every call. To construct the object on which FETCH will be invoked, tie calls the TIESCALAR class method that returns a blessed reference to a scalar value, that value is used to count the calls inside FETCH.
Alexander
|
|---|