Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Why am I seeing garbage in getEncodedString() whereas changeEncoding() shows correct value. I think this has something to do with the way perl stores the variable during function return.my changeEncoding { my $self = shift; my $stringToEncode = shift; my $EncodedString = Encode::utf8_encode{'$stringToEncode'}; print " $EncodedString "; <-- absolutely fine here . return $EncodedString; } sub getEncodedString { my $encodedString = changeEncoding(MultiByteChar); print $encodedString ; <--This is garbage here. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MultiByte Char handling in perl
by Eliya (Vicar) on Mar 07, 2012 at 17:09 UTC | |
by Anonymous Monk on Mar 07, 2012 at 17:32 UTC | |
by Eliya (Vicar) on Mar 07, 2012 at 17:41 UTC | |
by Anonymous Monk on Mar 07, 2012 at 17:56 UTC | |
|
Re: MultiByte Char handling in perl
by Anonymous Monk on Mar 07, 2012 at 15:48 UTC | |
by Anonymous Monk on Mar 07, 2012 at 16:49 UTC |