|Perl Monk, Perl Meditation|
Re: Messing with @_by goibhniu (Hermit)
|on May 30, 2008 at 14:23 UTC||Need Help??|
I would think the answer to your question:
Anyone care to tell me why this code is dangerous?would be situational. I can think of a situation where it might be dangerous, but can't say whether it's dangerous to you.
An example of where it's dangerous is where the undef is intended in the defined interface to be meaningful. What if your args are:
Then you'd be masking errors by fixing up the undefs instead of checking for them and handling them (though I suppose converting to '' might be a way to handle them).
Anyway, just brainstorming here. I think in the right situation you have a good idea.
Update: I was just thinking that if you're "messing" with the value so that you can present undef in output, perhaps you're looking to write a string_maybe_undef() function?
then you could
without actually messing with @_.
#my sig used to say 'I humbly seek wisdom. '. Now it says:
I humbly seek wisdom.