Hi Paul,
I think you're looking for:
sub suby {
$temp=$_[0];
print "$_[0]\n";
print "$$temp[0]\n";
}
I'm not sure why. It seems like it should be print "$$_[0]\n";, but I believe the
results I got from the interpreter. Output:
ARRAY(0x1ab28e0)
paul
ARRAY(0x1ab28e0)
paul
Joseph
Paul Kraus wrote:
> I don't understand why the output of the two print statements inside the
> subroutine is different. The one only prints the new line.
>
> #!/usr/bin/perl -w
>
> @array=qw/paul david kraus/;
> $arrayref=\@array;
>
> print "$arrayref\n";
> print "$$arrayref[0]\n";
>
> &suby($arrayref);
>
> sub suby {
> $temp=$_[0];
> print "$$_[0][0]\n";
> print "$temp[0]\n";
> }
>
> Paul Kraus
> Network Administrator
> PEL Supply Company
> 216.267.5775 Voice
> 216-267-6176 Fax
> www.pelsupply.com
>
>
>-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]