Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Scalar references

  • scalar references

Similar to array references and hash references one can also create references to scalars.

#!/usr/bin/env perl
use strict;
use warnings;

my $name = "Foo";
my $name_ref = \$name;

print "$name_ref\n";  # SCALAR(0x562516e5f140)
print "$name\n";      # Foo
print "$$name_ref\n"; # Foo