scalar and list context in Perl
来源:互联网 发布:脑白金的网络推广案例 编辑:程序博客网 时间:2024/06/04 18:24
example:
@people = qw( fred barney betty);
@sorted = sort @people; #list context: barney, betty, fred
$number = 42 + @people; # scalar context :45
@list = @people; # a list of 3 people
$n = @people;# the number 3
Force list context to scalar context:
@rocks = qw( talc q f d );
$number = @rocks;
print " the number is :", scalar @rocks, "hello";
print " the number is : $number hello";
above are the same
ps: there is no corresponding functions to force list context. It turns out you never need it.
- scalar and list context in Perl
- Learning Perl: 3.7. Scalar and List Context
- scalar and list context
- scalar in perl
- Learning Perl: 3.8. in List Context
- Learning Perl: 9.4. m// in List Context
- List and Array in Perl
- perl: scalar
- Perl Scalar
- Subqueries are not allowed in this context. Only scalar expressions are allowed.
- Learning Perl: 2.4. Scalar Variables
- Perl Learning 1 Scalar Data
- Subroutines and References in Perl
- Adding custom context menu in classical list
- 标题环境的分割返回最后一个值 (Slices in scalar context return the last item of the slice. )
- Learning Perl: 4.10. Non-Scalar Return Values
- [Perl语法篇] 数据类型:标量$Scalar
- excess elements in scalar initializer
- crtmpserver笔记之文档结构
- 活的没有意义
- Eclipse中配置Weblogic插件
- 关于剑指offer上面程序c语言实现
- MFC中使用正则表达式
- scalar and list context in Perl
- linux中select()函数分析
- Java基础知识学习三 (String类型,字符串处理)
- ubuntu1204常用快捷键
- 【live555】WISInput类及其重要相关类分析
- usaco_3.2.2
- cocos2d-x按钮回调方法的参数
- android中的侧滑效果
- ubuntu12.04下redis安装/配置