K
Ketema
I am a little lost on how PERL handles references and array's,
especially when you pass and array to a subroutine. Here is some code
I have working to try and get a better understanding. I read perldoc
perlref, and I just don't see why this isn't working...Please help!
#I'm working with a mime::entity object from net:op3
&getParts($mime_entity);
sub getParts {
print "The wierd variable \@_ consists of: ".scalar @_."
variables\n";
print "That passed variable: ".scalar @_->[0]." is a:
".ref(@_->[0])."\n";
#lets take the address of the passed array out of the hard to read
@_ variable which is a list of everything passed to the sub
my $passedArray = \@_[0];
print "passedArray now holds the address for the passed object.
passedArray holds: $passedArray\n";
print "The object located at the memory address passedArray holds is
a: ". ref({$passedArray})."\n";
print "Lets do some Tests.\n";
print "\@_->{'ME_Parts'} attribute is a
:".ref(@{@_[0]->{'ME_Parts'}});
print "passedArray->{'ME_Parts'} attribute is a
:".ref(@$$passedArray->{'ME_Parts'});
die "Debugging The real Way!";
}
especially when you pass and array to a subroutine. Here is some code
I have working to try and get a better understanding. I read perldoc
perlref, and I just don't see why this isn't working...Please help!
#I'm working with a mime::entity object from net:op3
&getParts($mime_entity);
sub getParts {
print "The wierd variable \@_ consists of: ".scalar @_."
variables\n";
print "That passed variable: ".scalar @_->[0]." is a:
".ref(@_->[0])."\n";
#lets take the address of the passed array out of the hard to read
@_ variable which is a list of everything passed to the sub
my $passedArray = \@_[0];
print "passedArray now holds the address for the passed object.
passedArray holds: $passedArray\n";
print "The object located at the memory address passedArray holds is
a: ". ref({$passedArray})."\n";
print "Lets do some Tests.\n";
print "\@_->{'ME_Parts'} attribute is a
:".ref(@{@_[0]->{'ME_Parts'}});
print "passedArray->{'ME_Parts'} attribute is a
:".ref(@$$passedArray->{'ME_Parts'});
die "Debugging The real Way!";
}