Re: data become zero after shift
- From: usenet@xxxxxxxxxxxxxxx
- Date: 30 Nov 2005 01:43:30 -0800
yong wrote:
> This is a part of a program which used to do base64 encode.
Hmmm. I wonder if there's a module for this on CPAN?
> }else
> {
> my $first_unpack=unpack("C",$firstbyte);
> print "\nfirst unpack is: ";
> print $first_unpack; # I get correct data here
> print "\n";
> }
The variable $first_unpack is lexically scoped (by 'my') to this block.
This becomes a whole new variable, and has no relationship to the
variable of the same name which you declared a few lines earlier. It
ceases to exist outside this block, and you're back to using the
previously defined variable of the same name, which is (still) undef.
.
- References:
- data become zero after shift
- From: yong
- data become zero after shift
- Prev by Date: Re: data become zero after shift
- Previous by thread: Re: data become zero after shift
- Next by thread: shift error
- Index(es):