Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^4: Ternary Quizical behaviour? (Ref vs Alias)

by LanX (Cardinal)
on Jul 10, 2020 at 21:51 UTC ( #11119165=note: print w/replies, xml ) Need Help??

in reply to Re^3: Ternary Quizical behaviour?
in thread Ternary Quizical behaviour?

> I don't think that's as common as you potentially think.

sometimes an example is clearer than many words:

the first arg to tst() is a scalar-ref, the second the scalar itself

DB<107> sub tst { print "ref of alias match: ".$_[0] if $_[0] == \ $ +_[1] ; $_[1] = 42 } DB<108> my $x =666; tst( \$x,$x); print "\n now x = $x" ref of alias match: SCALAR(0x339fb20) now x = 42

as you can see these are quite different concepts.

References are a datatype in Perl pointing to another thing.

Aliases are just the same thing by another symbolic name (sic).

And in fact, to prove it, that alias has even the identical reference!

compare also:

> never used the term alias to refer to a variable passed by reference.

well never too late! :)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11119165]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2020-09-21 20:05 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (127 votes). Check out past polls.