Help for this page

Select Code to Download


  1. or download this
    sub new {
        my ($class, $initial_int) = @_;;
        my $scalar = 0+($initial_int // 0);
        return bless \$scalar, $class;
    }
    
  2. or download this
    sub new {
        my ($class, $args) = @_;
    ...
        $args //= {};
        return bless $args, $class;
    }
    
  3. or download this
    my $o = Foo->new(0);
    ${$o}++; # dereference $o, then increment the value of the scalar that
    + the scalar reference in $o points to.
    
    # Because the dereferencing sigil binds more closely than the postincr
    +ement operator, you can also do this:
    $$o++; # dereference $o, then increment the value of the scalar that t
    +he scalar reference in $o points to.