标量项:

[root@wx03 2]# cat a1.pl
unshift(@INC,"/root/big/2");
use Horse;;
print $Horse::days;
print "\n";
[root@wx03 2]# cat Horse.pm
package Horse;
our $days="test111";
1; $Horse::days; 访问Horse 包中的变量$days 有时候你想为"所有名叫foo的东西"(无论他的印记是什么)起一个名字 。为此, 符号团记录可以有一个*作为前缀,这里的星号(*)表示所有其 他的印记。 这些称为类型团(typeglobs) perl main包: [root@wx03 2]# cat a2.pl
$bert="aa";
print "\$bert is $bert\n";
print "\$::bert is $::bert\n";
print $main::bert;
print "\n";
[root@wx03 2]# perl a2.pl
$bert is aa
$::bert is aa
aa 2.6.3 选择自己的引号: ` ` qx// 执行命令 是 [root@wx03 2]# cat a4.pl
@arr=`ls -ltr`;
print @arr;
print "\n"; @arr=qx/ls -ltr/;
print @arr;
print "\n"; [root@wx03 2]# cat a5.pl
print __LINE__;
print "\n";
print __FILE__;
print "\n";
print __LINE__;
print "\n";
[root@wx03 2]# perl a5.pl
1
a5.pl
5 __LINE__ 当前行号 __FILE__ 当前文件 [root@wx03 2]# cat a6.pl
print __PACKAGE__;
print "\n";
[root@wx03 2]# perl a6.pl
main 当前包为main包 [root@wx03 2]# cat a7.pl
print "111111111\n";
print "222222222\n";
print __END__;
print "333333333\n";
[root@wx03 2]# perl a7.pl
111111111
222222222
[root@wx03 2]# END 可以用于真正的文件结束符之前表示搅拌的逻辑结束, 任何后面的文本都被忽略 [root@wx03 2]# cat a8.pl
sub funkshun{
return(a1,a2,a3)}; $x=funkshun(); print "\$x is $x\n"; @x=funkshun();
print "\@x is @x\n"; [root@wx03 2]# perl a8.pl
$x is a3
@x is a1 a2 a3 2.7.3 空(void )环境: [root@wx03 2]# cat a9.pl
$stuff = ( "one", "two", "three");
print "\$stuff is $stuff\n";
[root@wx03 2]# perl a9.pl
$stuff is three 只是把值"three" 赋予了变量$stuff [root@wx03 2]# cat a10.pl
@stuff = ("one", "two", "three");
print "\@stuff is @stuff\n"; $stuff = @stuff;
print "\$stuff is $stuff\n";
[root@wx03 2]# perl a10.pl
@stuff is one two three
$stuff is 3 [root@wx03 2]# cat a11.pl
@stuff=(1,2,3);
@nonsense=(4,5,6);
sub funkshun{
return 100; }; @arr=(@stuff,@nonsense,funkshun());
print @arr;
print "\n";
print $arr[6];
print "\n";
[root@wx03 2]# perl a11.pl
123456100
100 [root@wx03 2]# cat a12.pl
%map = (
red => 0xff0000,
green => 0x00ff00,
blue => 0x0000ff,
); print $map{red};
print "\n";
[root@wx03 2]# perl a12.pl
16711680 初始化任何当作记录使用的匿名散列引用: [root@wx03 2]# cat t1.pl
$rec = {
NAME => 'John Simth',
RANK => 'Captain',
SERNO => '951413',
}; print $rec->{NAME};
print "\n";
[root@wx03 2]# perl t1.pl
John Simth 或者用命名的参数激活复杂的函数: 2.10 型团(typeglob) Perl 里面有种特殊的类型叫类型团(typeglob)用以保留整个符号表 记录。(符号表记录
*foo 包括 $foo, @foo, %foo,&foo 和其他几个 foo 的简单解释 值。)类型团
(typeglob)的类型前缀上一个 *,因为它代表所有类型。 [root@wx03 2]# cat t3.pl
$fh=*var;
$var=aa;
print "\$fh is $fh\n"; print "\$fh is $$fh\n"; [root@wx03 2]# perl t3.pl
$fh is *main::var
$fh is aa [root@wx03 2]# cat t3.pl
$fh=*var;
$var=aa;
print "\$fh is $fh\n"; print "\$fh is $$fh\n"; $bar="bbb";
*foo = \$bar;
print "\$foo is $foo\n"; $a1="aaaa111";
*foo=\$a1;
print $foo;
print "\n";
[root@wx03 2]# perl t3.pl
$fh is *main::var
$fh is aa
$foo is bbb
aaaa111 符号表就是引用: [root@wx03 2]# cat t4.pl
$bar="abc123";
*foo=\$bar;
print *foo;
print "\n"; print $foo;
print "\n";
[root@wx03 2]# perl t4.pl
*main::foo
abc123 2.11.2 行输入(尖角)操作符
[root@wx03 2]# cat t5.pl
while ($_ = <STDIN>) { print $_; };
[root@wx03 2]# perl t5.pl
1
1
33
33

<2>集腋成裘的更多相关文章

  1. 集腋成裘-13-git使用-02进阶篇

    上一篇我们简单介绍了如何安装和使用git,本次将简单介绍如何创建分支.处理冲突.提交与回滚 创建和合并分支是Git的一大特色. 使用场景:当有一个新功能要开发,但是又没有确定上线时间,不能合并到主干上 ...

  2. 集腋成裘-12-git使用-01创建库

    一.git安装教程 git安装比较简单,选择好安装路径,直接默认下一步即可 1:检查git是否安装成功 二.SourceTree工具 1:下载&安装 安装过程中如何免注册? 在C:\Users ...

  3. 集腋成裘-11-sql性能优化

    SQL Nexus是一个用于将SQL Trace数据.性能监视日志及T-SQL输出整合进一个单独的SQL Server数据库的工具. 先决条件 开始使用SQL Nexus之前,注意下面要做的事项: 安 ...

  4. 集腋成裘-09-ECharts -HelloECharts-02

    上一篇我们讲了可视化数据分析的重要性以及ECharts的一些的特性,这一篇我们继续学习一下ECharts的简单Demo 一:5 分钟上手 ECharts <!DOCTYPE html> & ...

  5. 集腋成裘-08-ECharts -简介-01

    目标:让数据说话. 大数据时代的到来以及有效应用,大幅度提升了企业的管理能力.决策科学化与可执行性水平,推动传统决策方式朝着数据驱动转型.可视化数据分析对决策者产生的意义将在事前预测.事中感知以及事后 ...

  6. 集腋成裘-06-angularJS -angular_02

    1.0 选项卡 其中涉及到了三目运算符号; <!DOCTYPE html> <html ng-app="test"> <head> <me ...

  7. 集腋成裘-05-angularJS -初识angular

    私以为angular的最大特点是:只关注数据 1.1 angular之:双向绑定 <!DOCTYPE html> <html ng-app=""> < ...

  8. 集腋成裘-03-css基础-02

    1.1 三种写法 内嵌式:样式只作用于当前文件,没有真正实现结构表现分离 外链式:作用范围是当前站点,真正实现了内容与表现分离 行内样式:仅限于当前标签,结构混在一起 1.2 标签分类 1.2.1 块 ...

  9. 集腋成裘-02-css基础-01

    CSS 层叠样式表(Cascading Style Sheets)(级联样式表) 1 选择器 1.1 写法 选择器是一个选择标签的过程. 选择器{属性:值;...} 1.2 基础选择器 标签选择器 类 ...

随机推荐

  1. 【DWR】Annotation入门

    DWR简介:http://baike.baidu.com/view/73492.htm?fr=aladdin DWR2.0以后新增加了JDK5的注解(Annotation)功能,使用注解功能之后可以从 ...

  2. IAR之工程配置

    参考 : IAR的Workspace顶部下拉菜单中Debug和Release http://blog.csdn.net/yanpingsz/article/details/5588525 ++++++ ...

  3. CentOS6.5实现rsync+inotify实时同步

    参考博文: 参考1:CentOS6.5实现rsync+inotify实时同步 参考2:inotify-tools+rsync实时同步文件安装和配置 CentOS 6.3下rsync服务器的安装与配置  ...

  4. nginx access_log 完全关闭

    最近在配置本地nginx开发环境时,发现一个问题,当server段不指定access_log时,并且http段中也未指定任何 access_log参数时,它会默认写到logs/access.log这个 ...

  5. OGG同构(ORACLE-ORACLE)、异构(ORACLE-MYSQL)同步配置及错误解析

    环境:11.2.0.3(已安装数据库实例)+OEL5.7 192.168.1.55 zlm sid:zlm11g 192.168.1.60 zlm2 sid:zlm11g 一.安装软件,配置环境,创建 ...

  6. 关于PhpDE zend ide破解方式

    1.文件和汉化文件 ZendStudio官方下载地址:http://www.geekso.com/component/zendstudio-downloads/ 百度云地址: 10.0.0.msi文件 ...

  7. 开源框架ViewPagerIndicator的使用——TabPageIndicator

    1.导入Android-ViewPagerIndicator库文件 下载地址:https://github.com/JakeWharton/ViewPagerIndicator 2.布局文件     ...

  8. Windebug双机调试环境搭建

    Windebug双机调试环境搭建    开始进行内核编程/驱动编程的调试工作是非常烦人的,由于程序运行与内核层不受操作系统的管控,所以容易引起主机蓝屏和崩溃是常有的事.这也就使得内核程序的调试成了一大 ...

  9. jQuery Mobile 入门基础教程

    jQuery Mobile是jQuery在手机上和平板设备上的版本.jQuery Mobile 不仅会给主流移动平台带来jQuery核心库,而且会发布一个完整统一的jQuery移动UI框架. jQue ...

  10. Linux下动态库使用

    1. 静态库和动态库的基本概念 静态库,是在可执行程序连接时就已经加入到执行码中,在物理上成为执行程序的一部分:使用静态库编译的程序运行时无需该库文件支持,哪里都可以用, 但是生成的可执行文件较大.动 ...