|Pathologically Eclectic Rubbish Lister|
Preserving empty fields in splitby pjf (Curate)
|on Feb 05, 2004 at 12:11 UTC||Need Help??|
If you don't want split to remove trailing empty fields, then you can supply it with a third argument, set to a negative value. Normally this is the maximum number of fields you wish split to generate, but Perl will interpret a negative number to mean leaving all fields intact, including empty ones.
In your particular example, you would change your split line to:
For more information on this feature, check out perldoc -f split or the online documentation on this function.
All the very best,
Perl Training Australia