On Fri, 2007-04-27 at 12:45 -0400, Chas Owens wrote: > On 4/27/07, Pierre Mariani <[EMAIL PROTECTED]> wrote: > > On Fri, 2007-04-27 at 12:03 -0400, Chas Owens wrote: > > > On 4/27/07, Pierre Mariani <[EMAIL PROTECTED]> wrote: > > > snip > > > > > - modify_variable() doesn't appear to modify anything, otherwise why > > > > > are you assigning its return value to the scalar passed as a > > > > > parameter? > > > > > It seems to be just a function. > > > > > > > > Modify_variable modifies its input variable. > > > > > > I think the issue is what you mean by "modifies". In order to say > > > that the modify_variable function modifies its input then something > > > like the following must be true: > > > > > > my $foo = 5 > > > modify_variable($foo) > > > print "$foo\n"; #prints "6\n" > > > > > > > Yeah, that's exactly it. >
Sorry, I realize I replied to fast and was wrong. The way the function works is: my $foo = 5; $foo = modify_variable($foo); print "$foo\n"; #prints "6\n" > Then why are you doing this > > $_ = modify_variable($_) > > in all of your examples? > snip > > Agree on that, but given other details that I didn't communicate, it is > > not quite possible (this is actually a pl/perlu function in postgresql, > > the variables I am working on are passed to the function, and their type > > is limited by the function definition, so unless I create a composite > > type I can't pass them as an array directly). > snip > > Perhaps you should describe the full situation then. Without that > information we will not be able to help you very much; we will end up > just shooting in the dark at what we think the problem is. Thank you, but I got it to work the way I wanted, thanks to Matthew and Rob's posts: map { modify_variable(${$_}) } = \($var1, $var2, $var3); I was continuing the discussion just for the sake of it... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/