in reply to Why are @_ and $_ not linked?
Now, you are correct that $_ is "remembering" when it was last set. This is because $_ (and @_) are both global variables in the truest sense of the word. (This, btw, is why you should always do local $_; in a sub within a module you intend on manipulating $_ within.)
So, the question I ask you is why aren't you doing something like
sub parse{ my $self=shift; my ($line) = @_; ($self->{'AN'}) = unpack("A5", $line); print $self->{'AN'}."\n"; }
Or, some other, more relevant, variable name ...
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|