Re: passing array ref to subroutine

2003-01-07 Thread R. Joseph Newton
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 Kr

Re: passing array ref to subroutine

2003-01-06 Thread Paul Johnson
On Mon, Jan 06, 2003 at 04:29:41PM -0500, 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. Hmm, I get "Use of uninitialized value in concatenation (.) or string at qw" for both. > #!/usr/bin/

RE: passing array ref to subroutine

2003-01-06 Thread Dan Muey
-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 d

RE: passing array ref to subroutine

2003-01-06 Thread Timothy Johnson
You should always include "use strict" and "use warnings" when you are writing code. Take a look at the subryoutine and you will see: $temp = $_[0] means that temp is now a reference to @array $temp[0] is the first element of the array @temp, which was created when you used the element $$_[0][0