Created
          September 1, 2014 02:45 
        
      - 
      
- 
        Save ytnobody/ffaed37e5b4797b66c21 to your computer and use it in GitHub Desktop. 
    answer for "ref ... and ... っていうのは何がしたい?"
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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}); | |
| }; | 
      
      
  Author
  
  
        
      
            ytnobody
  
      
      
      commented 
        Sep 1, 2014 
      
    
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment