Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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

by LanX (Sage)
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
Domain Nodelet?
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 chilling in the Monastery: (5)
As of 2022-06-29 07:20 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (96 votes). Check out past polls.