[EMAIL PROTECTED] wrote:
I've been following this debate all week and noticed one thing missing...
No-one has mentioned that it's bad programming practice to rely on a sub
to modify an argument. If you want to modify a value, it should be
explicitly returned, viz.:
sub add_one {
my $in_var =
[EMAIL PROTECTED] schreef:
> Content-Type: multipart/mixed; boundary [...]
Switch off the HTML, and stop top-posting and cross-posting.
--
Affijn, Ruud
"Gewoon is een tijger."
___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubs
PROTECTED]
12/13/2005 21:19
To:
cc: , <[EMAIL PROTECTED]>
Subject: Passing arguments by value
-Original Message-
On Behalf Of John W. Kennedy
Sent: Tuesday, December 13, 2005 1:31 PM
Subject: [lists] Re: Passing arguments by valu
"John W. Kennedy" <[EMAIL PROTECTED]>
12/13/2005 15:30
To: [EMAIL PROTECTED]
cc: Peter Scott <[EMAIL PROTECTED]>, [EMAIL PROTECTED], activeperl@listserv.ActiveState.com
Subject: Re: Passing arguments by value
[EMAIL PROTECTE
On Tue, 13 Dec 2005, R. S. van Keuren wrote:
> W. Kennedy Sent wrote:
> > There are languages and cultures in which that applies, and others
> > in which it does not. Perl is not clearly on the one side or the
> > other.
>
> It is a common practice in many languages to pass a pointer to a
> structu
alf Of John W. Kennedy
Sent: Tuesday, December 13, 2005 1:31 PM
Subject: [lists] Re: Passing arguments by value
[EMAIL PROTECTED] wrote:
I've been following this debate all week and noticed one thing
missing... No-one has mentioned that it's bad programming practice to
rely on a su
-Original Message-
On Behalf Of John W. Kennedy
Sent: Tuesday, December 13, 2005 1:31 PM
Subject: [lists] Re: Passing arguments by value
[EMAIL PROTECTED] wrote:
>
> I've been following this debate all week and noticed one thing
> missing... No-one has mentioned
[EMAIL PROTECTED] wrote:
I've been following this debate all week and noticed one thing
missing... No-one has mentioned that it's bad programming practice to
rely on a sub to modify an argument. If you want to modify a value, it
should be explicitly returned, viz.:
sub add_one {
my $in_var
David Nicol wrote:
> Is anyone besides $Bill Luebkert confused by the suggestion in perldoc that
> passing a perl reference to a container is the way to keep the container
> from getting flattened, to the point that the doc would benefit from a
> rewrite?
Are you insinuating that I'm confused by
Is anyone besides $Bill Luebkert confused by the suggestion in perldoc that
passing a perl reference to a container is the way to keep the container
from getting flattened, to the point that the doc would benefit from a
rewrite?
--
David L Nicol
I'll see your time division multiplexing and
raise y
I've been following this debate all week and noticed one thing missing... No-one has mentioned that it's bad programming practice to rely on a sub to modify an argument. If you want to modify a value, it should be explicitly returned, viz.:
sub add_one {
my $in_var = shift;
return( ++$in_var
On Mon, 12 Dec 2005 10:50:44 -0800, $Bill Luebkert wrote:
> Peter Scott wrote:
>> On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote:
>
>> No we aren't. The phrase "pass by reference" is a computer science term
>> that predates the invention of Perl. The word "reference" therein does
>> n
Peter Scott wrote:
> No we aren't. The phrase "pass by reference" is a computer science term
> that predates the invention of Perl.
And which applies to *compiled* programs where vrbls have a descreet location.
> The word "reference" therein does
> not refe
http://www.google.com/search?q=define%3A+pass+by+reference
___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Peter Scott wrote:
> On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote:
> No we aren't. The phrase "pass by reference" is a computer science term
> that predates the invention of Perl. The word "reference" therein does
> not refer to Perl references but to whether the caller's variable ca
On 12/12/05, Peter Scott <[EMAIL PROTECTED]> wrote:
> On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote:
> > We're talking Perl
> > references here.
>
> No we aren't. The phrase "pass by reference" is a computer science term
> that predates the invention of Perl. The word "reference" there
On Sun, 11 Dec 2005 21:32:09 -0800, $Bill Luebkert wrote:
> David Nicol wrote:
>
>> On 12/10/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote:
>>
>>>The fact that you can modify the vrbl passed to a sub from in the sub
>>>without using a reference still doesn't mean that it's passed by
>>>reference.
David Nicol wrote:
> On 12/10/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote:
>
>>The fact that you can modify the vrbl passed to a sub from in the sub without
>>using a reference still doesn't mean that it's passed by reference.
>
> No. You are mistaken. That is exactly what passing by reference
On 12/10/05, $Bill Luebkert <[EMAIL PROTECTED]> wrote:
> Chaddaï Fouché wrote:
>
> > $Bill Luebkert wrote:
> >
> >
> >>Perl normally passes by value .
> >>
> >
> > That is unaccurate : Perl always passes by reference (or rather by
> > alias), but we do the copy ourselves when we handle the argument
$Bill Luebkert wrote:
The fact that you can modify the vrbl passed to a sub from in the sub without
using a reference still doesn't mean that it's passed by reference. This is
a special case that aliasing provides. This could be partially an exercise
in semantics though.
This aliasing provi
Chaddaï Fouché wrote:
> $Bill Luebkert wrote:
>
>
>>Perl normally passes by value .
>>
>
> That is unaccurate : Perl always passes by reference (or rather by
> alias), but we do the copy ourselves when we handle the arguments array :
> @_ always has aliases on the arguments.
The fact that Per
$Bill Luebkert wrote:
Perl normally passes by value .
That is unaccurate : Perl always passes by reference (or rather by
alias), but we do the copy ourselves when we handle the arguments array :
@_ always has aliases on the arguments.
eg :
sub increment { $_[0]++ }
sub increment2 {
my $arg
On Dec 10, 2005, at 05:30, Joseph C. Bautista wrote:
Sorry bill for the lack of sample on my part. But I was wondering if
its
possible to PERL to pass an argument "byref" or "byval" like that of
visual
basic
Perhaps a bit of an explanation will help clarify.
Yes, it is possible, though its
Joseph C. Bautista wrote:
> Sorry bill for the lack of sample on my part. But I was wondering if its
> possible to PERL to pass an argument "byref" or "byval" like that of visual
> basic whereas if I passed a $one variable as a reference, changes made by
> subroutines in the value will reflects in
> Perl normally passes by value - to pass by reference you would explicitly
> do so or pass a value that is already a reference.
>
> EG:
>
> my $one = 1;
> my $oneref = \$one;
>
> mysub (1);# will pass the value 1
> mysub ($one);
>
> mysub (\1); # will pass a reference to 1
> mysub (\$o
Joseph C. Bautista
Senior Engineer OSS
Future Communication Company International, Kuwait
Mobile : +965 9394038
Email Add : [EMAIL PROTECTED]
URL : www.fcciq8.com
Sorry bout this, I should have tried better...
>
> Ex. (AS REFERENCE)
>
> {
> my $one = 1;
> &mysub($one);
>
> print "value is : $
Joseph C. Bautista wrote:
> Hi All,
>
>Is there a way in perl to pass arguments by value? Normally it’s
> treating every arguments to be pass as a reference…
Perl normally passes by value - to pass by reference you would explicitly
do so or pass a value that is already a reference.
EG:
Hi All,
Is there
a way in perl to pass arguments by value? Normally it’s treating every
arguments to be pass as a reference…
Thank
you…
Joseph C. Bautista
Senior Engineer OSS
Future Communication Company International, Kuwait
Mobile : +965
9394038
Email A
28 matches
Mail list logo