Vicky Vicky - 1 year ago 131
Perl Question

What is \0 (a number prefixed with a backslash) in Perl?

I saw a piece of code in Perl as below:

my $SUCCESS = \0;
my $FAILURE = \1;


It is an assignment and I cannot understand the significance of \1 and \0.

Answer Source

\1 creates a reference to a scalar. Print $SUCCESS and you'll see SCALAR(0xb83938) or something similar. In order to get the value try printing $$SUCCESS and you should get the value of the variable.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download