Re: returning more than 1 scalar from a subroutine

2001-10-31 Thread Brett W. McCoy
On Wed, 31 Oct 2001, Roy Peters wrote: > Is there any way to return 2 or 3 scalar variables from a subroutine (like > passing a variable by reference in C)? > > I would like to avoid returning an array, if possible, because it makes > the script very non-intuitive. In what ways does it make it n

Re: returning more than 1 scalar from a subroutine

2001-10-31 Thread Jenda Krynicky
From: Roy Peters <[EMAIL PROTECTED]> > Is there any way to return 2 or 3 scalar variables from a subroutine > (like passing a variable by reference in C)? > > I would like to avoid returning an array, if possible, because it > makes the script very non-intuitive. Sorry? You th

Re: returning more than 1 scalar from a subroutine

2001-10-31 Thread Jos I. Boumans
ten wise to just pass around references. if you want to know more about the why and how, take a look at http://japh.nu and read the tutorial on references. hth, Jos > -Original Message- > From: Roy Peters [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 31, 2001 7:44 A

Re: returning more than 1 scalar from a subroutine

2001-10-31 Thread Jeff 'japhy' Pinyan
On Oct 31, Roy Peters said: >Is there any way to return 2 or 3 scalar variables from a subroutine (like >passing a variable by reference in C)? > >I would like to avoid returning an array, if possible, because it makes >the script very non-intuitive. Subroutines can return any number of argumen

Re: returning more than 1 scalar from a subroutine

2001-10-31 Thread Pete Emerson
If I understand your question correctly, this will work: #!/usr/bin/perl -w use strict; my ($a, $b, $c, $one, $two, $three); $a=1; $b=2; $c=3; ($one, $two, $three)=Change($a, $b, $c); print "$one $two $three\n"; sub Change { my ($x, $y, $z)=@_; $x++; $y=0; $z=10; return ($x, $y, $z

RE: returning more than 1 scalar from a subroutine

2001-10-31 Thread Joshua Colson
r 31, 2001 7:44 AM To: [EMAIL PROTECTED] Subject: returning more than 1 scalar from a subroutine hi, Is there any way to return 2 or 3 scalar variables from a subroutine (like passing a variable by reference in C)? I would like to avoid returning an array, if possible, because it makes the script

returning more than 1 scalar from a subroutine

2001-10-31 Thread Roy Peters
hi, Is there any way to return 2 or 3 scalar variables from a subroutine (like passing a variable by reference in C)? I would like to avoid returning an array, if possible, because it makes the script very non-intuitive. Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com