in reply to split'ing lines with variable number of fields
Perl provides the ||= orequals operator which is used in the following way...
Your code above allows for $second to be 0 (zero) and is perfectly readable. This (||=) way will not test for defined but for a true value so if $second is not allowed to be 0 (zero) then this is ideal (and more succinct). Otherwise, leave it how it is.$second ||= $first;
Hope this helps, larryk
* now that I'm not first to reply!
"Argument is futile - you will be ignorralated!"
|
|---|