Memoize

BasicWerk   EC Support   Technique   Facebook  

20141120185638_Perl_no_name_hash_ref

Perl_no_name_hash_ref

 

 

 
#! /usr/bin/perl
use warnings;
use strict;
 
my @members = ();
 
foreach my $name ( qw( Harry Sarry James ) ) {
    # { } で囲むとハッシュのリファレンスを返す
    push @members, { 'name' => $name, 'is_member' => 1, };
}
 
print "name: $members[1]->{'name'}, is_member: $members[1]->{'is_member'}\n";
# -> name: Sarry, is_member: 1
 

 


© Shin Nakamura/BasicWerk 2014