to mr meltzer, mr cline, and mr mccoy of the [EMAIL PROTECTED] list:
Thank You!!! that was it! i remember looking at return function
before, briefly, but for some reason had thought it was only for
working within control loops... please, don't ask me why, it seems
stupid to me, too, now...
but y
> [returning values from a sub?]
As other posters have said, just return a list
of some sort. Note that stuff gets flattened.
So if you do:
sub flat {
$foo = '1';
@bar = (2, 3);
$baz['4'} = 5;
return $foo, @bar, %baz, ['qux', 'waldo']
}
@list = flat;
On Tue, 8 May 2001, Adam Theo wrote:
> so, in short, any way i can get a subroutine to send *back* arguments
> to the piece of code that called it? all of this will be within the
> same program, i just am hoping there is a way to do this.
The last expression evaluated in a subroutine is returned
Hi Adam,
Are you talking about doing:
sub foo {
my $arg1 = 1;
my $arg2 = 2;
my ($one, $two) = bar($arg1, $arg2);
print qq{$one and $two};
}
sub bar {
my $arg1 = shift;
my $arg2 = shift;
return ++$arg1, ++$arg2;
}
Cheers,
Kevin
hello, all. i just signed onto this list, and i have to say *wow, it's active!*. just
got my first digest version, and it has over 1,400 lines in it!
well, anyway, while i hope to be able to help out and give advice and answers to many
people on this list, i have a question of my own right now.