Skip to content

Instantly share code, notes, and snippets.

@nonkr
Last active December 27, 2015 20:59
Show Gist options
  • Save nonkr/7388344 to your computer and use it in GitHub Desktop.
Save nonkr/7388344 to your computer and use it in GitHub Desktop.
Perl进阶笔记
#在package中定义私有函数
#方法一
sub p_func
{
caller eq __PACKAGE__ or die;
print "test\n";
}
#方法二
my $p_func = sub {
print "test\n";
};
#=========================
my @book = (
"Seek Away",
"For True"
);
my %info = (
"name" => "jason",
"age" => 22
);
my %guy = (
"book" => \@book,
"info" => \%info
);
#更简洁的写法
my %guy = (
"book" => [
"Seek Away",
"For True"
],
"info" => {
"name" => "jason",
"age" => 22
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment