in reply to Way to do a "scalar ref"?
You can explicitly pass a reference if you like, or you can use the dark voodoo of prototypes. You could define
sub test(\$) { my ($scalar_ref) = @_; $$scalar_ref =~ tr/a-m/N-Z/; substr($$scalar_ref, 0, 0) = "prepended sumthin'"; }
and it should do what you want. Just make calls like
test($t)until your heart is content. You just have to make sure that test(\$) is seen before making the call. And be careful what you pass as an argument to test() because prototypes can work differently than you think they should.
|
---|
In Section
Seekers of Perl Wisdom