August 1999 Return to the Perl Hardware Store Slide #14

Globject Sigils

This slide is only here so that it will get into your printed notes. Unfortunately, I screwed up the printed version. Duhhhhhh.

If $self is a blessed reference to a glob, then:

        $self              filehandle / dirhandle
        ${*$self}          scalar
        @{*$self}          array
        $#{*$self}         array size
        *$self->[...]      array element
        ${*$self}[...]     array element
        @{*$self}[...]     array slice
        %{*$self}          hash
        *$self->{...}      hash element
        ${*$self}{...}     hash element
        %{*$self}{...}     hash slice
        $self->method(...) call a method
        *$self->(...)      call the function

The pattern here: If $self is a globref, then {*$self} is syntactically just like a Reference.

Next Copyright © 1999 M-J. Dominus