![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
(Slice 'em and Dice 'em) RE: Arrays are not listsby mwp (Hermit) |
on Aug 05, 2000 at 12:25 UTC ( #26326=note: print w/replies, xml ) | Need Help?? |
I'd like to give you a good trouting, but I'm not certain if you did this on purpose or not. :-) The "proper" way to take a slice is as follows:
This will return the desired result. I think a better example to illustrate your point (lists vs. arrays) would have been this:
I apologize for the length and relative messiness of the code (this would be a good place to use write formats) but I hope I get my point across. Essentially, I follow what you're saying and you raise several crucial issues. Most importantly, PAY ATTENTION to A) where the return value(s) from your function are being used, and B) how your function is delivering those return values. Is it clear, or at least documented? &ret_bad() in particular scares me, I would hate to have a library full of functions like that. "Huh, I got the LAST element of the list? WTF?" I hope I don't come across as being snide. I understand what you are trying to say and it was definitely a very thoughtful post, and should serve as a warning to us all. Thank you. :-) Patience, meditation, and good use of the scalar function will see us through. Alakaboo
In Section
Meditations
|
|