摘要:
哈希元素赋值: $hash{$some_key} = ‘something' 访问整个哈希: %some_hash = (’a' , '0' , 'b' , '1' , 'c' , '3') @any_array =%some_hash #哈希展开,获得所有哈希的键值对,乱序。 哈希赋值: my % 阅读全文
posted @ 2019-07-18 15:01
春风一郎
阅读(228)
评论(0)
推荐(0)
摘要:
1. chmop($line=<STDIN>) ; #读取下一行,截掉换行符。 2. while(defined($line=<STDIN>) { print " $_ ”; } 3. while(<STDIN>) { print ”$_"; } 等价于 while(defined($_ = <ST 阅读全文
posted @ 2019-07-18 14:32
春风一郎
阅读(311)
评论(0)
推荐(0)
摘要:
子程序的定义是全局的,不需要事先声明。若重复定义子程序,后面的覆盖前面的。 sub marine { $n +=1; print " Hello ,sailor number $_ ! "; } 调用:&marine; 返回值:最后一次的运算结果会被当作返回值。 变量:所有变量默认为全局变量 参数: 阅读全文
posted @ 2019-07-18 11:31
春风一郎
阅读(306)
评论(0)
推荐(0)