AnomalousMonk has asked for the wisdom of the Perl Monks concerning the following question:
If an empty string is packed with the 'u*' template and then unpacked with the same template, the resulting value is undefined.
Is this behavior specified? Expected? Desired?
(I have never worked with pack and unpack) UU-encoding before, and have found a simple work-around for the 'problem', if such it be, and there is no compelling need to use this encoding in the first place. But now I'm curious...)
>perl -v This is perl, v5.8.2 built for MSWin32-x86-multi-thread ... Binary build 808 provided by ActiveState Corp. Built Dec 9 2003 10:19:40 ... >perl -wMstrict -le "my $ue = pack 'u*', ''; print 'ue undefined' unless defined $ue; print qq{:$ue:}; my $ud = unpack 'u*', $ue; print 'ud undefined' unless defined $ud; print qq{:$ud:}; " :: ud undefined Use of uninitialized value in concatenation (.) or string at ... ::
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UU-decode unpack of empty string yields undefined value
by almut (Canon) on May 13, 2009 at 11:05 UTC | |
by AnomalousMonk (Archbishop) on May 13, 2009 at 15:15 UTC | |
by almut (Canon) on May 13, 2009 at 15:56 UTC | |
|
Re: UU-decode unpack of empty string yields undefined value
by december (Pilgrim) on May 13, 2009 at 06:42 UTC | |
by almut (Canon) on May 13, 2009 at 07:05 UTC |