Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: split and uninitialized variables

by markjugg (Curate)
on Sep 03, 2004 at 15:38 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://388313]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-25 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found