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 $one and if " as value ", $one
> will remain as is no matter what changes made by subroutine.
# by value $one will not change:
use strict;
use warnings;
{
my $one = 1;
mysub ($one);
print "value is : $one\n"; # will print "value is : 1";
sub mysub {
my $one = shift;
$one++; # does nothing in this example
}
}
# by ref $one can be changed :
{
my $one = 1;
mysub2 (\$one);
print "value is : $one\n"; # will print "value is : 2";
sub mysub2 {
my $oneref = shift;
++$$oneref;
}
}
__END__
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs