in reply to Build your array with push
Personally I don't see any evident maintainability advantage that initialization-by-pushes buys me over the "standard" one that any decent text editor couldn't give me just as easily. The only "problem", if you really, really want to call it a problem, may have to do with the first and last entry. If you're really, really that concerned about the few extra keystrokes these may involve, then you how 'bout
my @folk = ( "Hibbs", "Daglish", "Schwartz", "Vroom", );
instead?
Now you're going to show me something that uses "qw", aren't you? OK, go ahead, but don't forget to show me how it looks when an entry contains spaces.
What's the problem? If I have a set of "words" (in the qw// acceptation!) then I use qw//. If I have a set of "strings" some of which contain spaces or may cointain spaces in a future re-editing of the code, then I don't. Period!
Oh, and in the unlikely case I implemented a list with qw// and later it turned out that some entries must contain spaces, I have quite a few workarounds none of which is likely to cause any major nor minor damage to my hands, sight, brain, etc.
|
---|