in reply to Encode::decode_utf8 and references
If you were actually expecting to set the utf8 flags on the keys and values of the hash that is being passed by reference, that would simply be a misconception in your code. (But I gather that was not the intention.)
If it's just a situation that you are doing something with a list of who-knows-what, and you're just passing every element of the list to decode_utf8, regardless of what it might be, well, that seems a bit silly. You didn't show an actual snippet from the application in question, but I think it might be better for you, if your code looks something like this:
to just add a little bit to make it sensible, like this:@olist = map { decode_utf8( $_ ) } @ilist;
Given what you've said, I'd suggest that you treat the problem as a bug in your app -- functions intended for strings should not be applied to references. (You wouldn't pass a hashref to substr() or index(), would you?)@olist = map { (ref() ? $_ : decode_utf8( $_ ) } @ilist;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Encode::decode_utf8 and references
by samtregar (Abbot) on Jun 18, 2006 at 03:25 UTC |