Re: improving my code: array of references
- From: frenchyp@xxxxxxxxx (Pierre Mariani)
- Date: Fri, 27 Apr 2007 09:54:37 -0700
On Fri, 2007-04-27 at 12:45 -0400, Chas Owens wrote:
On 4/27/07, Pierre Mariani <frenchyp@xxxxxxxxx> wrote:
On Fri, 2007-04-27 at 12:03 -0400, Chas Owens wrote:
On 4/27/07, Pierre Mariani <frenchyp@xxxxxxxxx> 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 issnip
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).
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...
.
- Follow-Ups:
- Re: improving my code: array of references
- From: Paul Johnson
- Re: improving my code: array of references
- References:
- Problem using $1 in substitution command
- From: Andreas Karlsson
- improving my code: array of references
- From: Pierre Mariani
- Re: improving my code: array of references
- From: Rodrick Brown
- Re: improving my code: array of references
- From: Pierre Mariani
- Re: improving my code: array of references
- From: Matthew J. Avitable
- Re: improving my code: array of references
- From: Pierre Mariani
- Re: improving my code: array of references
- From: Chas Owens
- Re: improving my code: array of references
- From: Pierre Mariani
- Re: improving my code: array of references
- From: Chas Owens
- Problem using $1 in substitution command
- Prev by Date: Re: improving my code: array of references
- Next by Date: perl and cygwin perl (unix style paths)
- Previous by thread: Re: improving my code: array of references
- Next by thread: Re: improving my code: array of references
- Index(es):
Relevant Pages
|