Skip to content

Instantly share code, notes, and snippets.

@ytnobody
Created September 1, 2014 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ytnobody/ffaed37e5b4797b66c21 to your computer and use it in GitHub Desktop.
Save ytnobody/ffaed37e5b4797b66c21 to your computer and use it in GitHub Desktop.
answer for "ref ... and ... っていうのは何がしたい?"
use strict;
use warnings;
use Data::Dumper;
### case of scalar
{
my $data = 123;
ref $data and $data = undef;
print Dumper({'SCALAR' => $data});
};
### case of reference
{
my $data = { hoge => 'fuga' } ;
ref $data and $data = undef;
print Dumper({'HASHREF' => $data});
};
@ytnobody
Copy link
Author

ytnobody commented Sep 1, 2014

$VAR1 = {
          'SCALAR' => 123
        };
$VAR1 = {
          'HASHREF' => undef
        };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment