Help for this page

Select Code to Download


  1. or download this
    my @array = (1, 2, 3);
    my $aref = \@array;
    showarray($aref);
    ...
    __DATA__
    ARRAY: 1 2 3
    Not an ARRAY reference at reftype.pl line 14.
    
  2. or download this
    use B;
    sub refcheck {
      my $ref = shift;
      return ref(B::svref_2object($ref)) =~ /B::(\w+)/;
    }
    
  3. or download this
    sub reftype {
      my $ref = shift;
      $ref =~ s/\(.*\)$//; # get rid of the (0x0000000) portion of the ref
    +erence
      $ref =~ s/^.*=//;    # get rid of the CLASS= portion of the referenc
    +e
      return $ref;
    }