![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
Re^2: Should chomping a constant always raise an error?by BrowserUk (Patriarch) |
on Mar 11, 2005 at 05:23 UTC ( #438538=note: print w/replies, xml ) | Need Help?? |
That would require anyone calling the sub to tie the constants--which makes no sense at all. It just took me by surprise that chomp died when asked to inspect a variable that was readonly. The work-arounds are myriad:
But, as chomp has to determine if there is anything to chomp, before attempting to modify it's argument, I just expected it to make that determination before checking for readonlyness. It doesn't do it that way, so I have to do extra tests or copies myself. I've gotten spoiled by Perl's DWIMming things like negative offsets don't die, they work backwards from the end. Same with negative subscripts; ranges that produce no values; empty lists that act correctly regardless of the context etc. On this occasion it didn't DWIM for me. Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
In Section
Seekers of Perl Wisdom
|
|