-----Original Message-----
From: Paul Kraus [mailto:[EMAIL PROTECTED]] 
Sent: Monday, January 06, 2003 3:30 PM
To: Perl
Subject: passing array ref to subroutine
Because the second one is printing the '0' item fo an array called 'temp' you need to 
do
$$temp[0] the same as you did $$_[0]

Dan

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]

Reply via email to