> 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 (\$one);
> mysub ($oneref);
> 

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 $one and if " as value ", $one
will remain as is no matter what changes made by subroutine.

Ex. (AS REFERENCE)
 
{
my $one = 1;
&mysub($one);

print "value is : $one "; ## will print "value is : 2";
}
sub mysub{
  my ( $one ) = @_;
  $one++;       
}

(AS VALUE)

{
my $one = 1;
&mysub($one);

print "value is : $one "; ## will print "value is : 1";
}
sub mysub{
  my ( $one ) = @_;
  $one++;       
}

> 
> --
> This message has been scanned for viruses and dangerous content by host-
> center.net and is believed to be clean.



-- 
This message has been scanned for viruses and dangerous content by 
host-center.net and is believed to be clean.

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to