in reply to Re^4: How to reference to array keys?
in thread How to reference to array keys?

The line with split works this way: First of all the left side of the equation is in parentheses, so it provides list context to the left side (many functions return different things in different contexts, see the first two paragraphs of split

So the split in list context returns a list of strings that get distributed to the list on the left side of the equation. This list begins with a scalar, so the first item in the list is stored in the scalar. The second variable is an array and arrays just take everything they can get, so all the other strings are pushed into @rest. If there were another array or scalar at the end of the list on the left side, it would be empty. If another scalar were before @rest, it would hold the second item of the list of strings

(!$current_owner) is true when $current_owner is false. $current_owner is false if it is undef, the empty string ("") or 0. Since $current_owner is initialized with the empty string, this condition is at least true the first time the subroutine process_owner_record is called.

Replies are listed 'Best First'.
Re^6: How to reference to array keys?
by mmartin (Monk) on Jul 29, 2011 at 13:24 UTC

    Jethro,

    Thanks for the reply. Good explanation, makes much more sense now!


    Thanks, Matt