D
dorno
Passing variables to a subroutine by reference is covered in depth by any
of the books. Like this...
myroutine(\$var1, \@array1, \%hash1);
sub myroutine {
my($scalar, array, hash) = @_;
}
All the variables get to the subroutine intact and no problem.
But if I want to change the $scalar to a literal, like so.
myroutine("myvariable", \@array1, \%hash1);
It hoses the call and attaches the literal as a member of the array.
To make it work I have to...
my $var1 = "myvariable";
myroutine(\$var1, \@array1, \%hash1);
which takes it back to square one. No problem there, it works, but I was
wondering if there is a way to pass a bare literal with other references?
There has to be - in fact with Perl there is probably a dozen ways. But
my trying and reading hasn't found it yet. This is one of those things
that the more I try the behinder I get.
Thanks any
dorno
of the books. Like this...
myroutine(\$var1, \@array1, \%hash1);
sub myroutine {
my($scalar, array, hash) = @_;
}
All the variables get to the subroutine intact and no problem.
But if I want to change the $scalar to a literal, like so.
myroutine("myvariable", \@array1, \%hash1);
It hoses the call and attaches the literal as a member of the array.
To make it work I have to...
my $var1 = "myvariable";
myroutine(\$var1, \@array1, \%hash1);
which takes it back to square one. No problem there, it works, but I was
wondering if there is a way to pass a bare literal with other references?
There has to be - in fact with Perl there is probably a dozen ways. But
my trying and reading hasn't found it yet. This is one of those things
that the more I try the behinder I get.
Thanks any
dorno