Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: split and uninitialized variables

by markjugg (Curate)
on Sep 03, 2004 at 15:38 UTC ( #388313=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://388313]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2017-09-20 00:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (230 votes). Check out past polls.

    Notices?