weidagang2046的专栏

物格而后知致
随笔 - 8, 文章 - 409, 评论 - 101, 引用 - 0
数据加载中……

Perl Tips 2006/8/19

2 Perl language tips are met today.

1. a code snippet is as follows:
 
$code[$idx] =~ /^\s*(.+?)\s*$/;
$code[$idx] = $1;

Seem it's to extract the content without leading and tailing white space. But the (.+?) is still not understood.

2. a code snippet is as follows:

my $currentframe;
$currentframe = {
 _pc_ => 0,
 _func_ => 'main'
 };

what's the type of $currentframe? handle to a hashtable? 


Answer: $currentframe is a reference to an anonymous hash. Usage: $$currentframe{_pc_} or $currentframe->{_pc_}

posted on 2006-08-19 19:39 weidagang2046 阅读(317) 评论(0)  编辑  收藏 所属分类: Perl


只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问