in reply to Re: split and uninitialized variables
in thread split and uninitialized variables

This solution is novel and works, but I don't recommend it.

. It's more important to have code that is clear and easy to read than to be as concise and compact as possible. The clearest solution is to simply use a second line to initialize the variables.

  • Comment on Re^2: split and uninitialized variables

Replies are listed 'Best First'.
Re^3: split and uninitialized variables
by Eimi Metamorphoumai (Deacon) on Sep 03, 2004 at 15:51 UTC
    I'm aware of the importance of clarity. If I were golfing I would have done something like
    my ($x, $y, $z) = split(',', "$_,,");
    but this was the most natural answer to me. The problem, as I saw it, was "sometimes the list returned by split is too short, and I want empty strings to fill missing places at the end," so the most natural answer I saw was to add items to fill it out.