本帖最后由 Mr-Summer 于 2013-03-30 14:14 编辑
https://code.google.com/codejam/contest/32016/dashboard#s=p0
Google Code Jam 上的练习题目(计算给定2个数组的两两乘积和的最小值),想用perl试一下但是不知道结果为啥不对,求解惑。[code]open IN,"D:/Home/perl/Google Code Jam/A-small-practice.in";
open OUT, ">","D:/Home/perl/Google Code Jam/A-small-practice.out";
$test_case_num =
by Mr-Summer - Perl - 2013-03-30 15:53:05 阅读(2042) 回复(4)
刚开始接触perl,想问下,这段代码里的scalar是什么意思呢,多谢![code] my $i = 0; until($i >= scalar @array) { print $i, ": ", $array[$i]; $i++; } [/code]
1,qw不是分隔字符串的意思吗? 比如 @a = qw(this is a test);这样不是就吧整个字符串分开存如数组了吗? 但是我看有的地方在很多程序的开头也有类似的代码?比如 use CGI wq(:standard);这个又是什么意思呢? 上面的区别是什么呢?用法有什么不同吗?还有什么特比的吗? 2,还有个函数scalar不是求数组元素个数的吗? 比如 $a = scalar(@a);这样就可以得到数组有多少个元素。 但是我看有的地方用到了时间上比如 scalar(localti...
scalar 100 quantum ADIC scalar100 ADIC scalar100磁带库 全国统一服务电话 TEL:400-888-6656 Part Number Alternate P/N Description 72-1126-02 17-1165-03 MN PCB 72-1127-01 17-1167-03 SCSI HVD, LVD/SE, PCB 72-1128-02 17-1198-01 PICKER CONTROL PCB 9-00659-01 2-00245-02 PICKER CONTROL PCB 72-1129-03 96-5334-01 DISPLAY ASSY 72-1125-01 17-1166-02 PD PCB 72-1134-03 96-5398-02 ROTARY PK, DLT 72-1134-04 96-539...
scalar 100 quantum ADIC scalar100 ADIC scalar100磁带库 全国统一服务电话 TEL:400-888-6656 Part Number Alternate P/N Description 72-1126-02 17-1165-03 MN PCB 72-1127-01 17-1167-03 SCSI HVD, LVD/SE, PCB 72-1128-02 17-1198-01 PICKER CONTROL PCB 9-00659-01 2-00245-02 PICKER CONTROL PCB 72-1129-03 96-5334-01 DISPLAY ASSY 72-1125-01 17-1166-02 PD PCB 72-1134-03 96-5398-02 ROTARY PK, DLT 72-1134-04 96-539...
ADIC scalar100磁带库 全国统一服务电话 TEL:400-888-6656 Part Number Alternate P/N Description 72-1126-02 17-1165-03 MN PCB 72-1127-01 17-1167-03 SCSI HVD, LVD/SE, PCB 72-1128-02 17-1198-01 PICKER CONTROL PCB 9-00659-01 2-00245-02 PICKER CONTROL PCB 72-1129-03 96-5334-01 DISPLAY ASSY 72-1125-01 17-1166-02 PD PCB 72-1134-03 96-5398-02 ROTARY PK, DLT 72-1134-04 96-5398-01 ROTARY PK, LTO 72-1261-01 96-...
ADIC scalar100磁带库 全国统一服务电话 TEL:400-888-6656 Part Number Alternate P/N Description 72-1126-02 17-1165-03 MN PCB 72-1127-01 17-1167-03 SCSI HVD, LVD/SE, PCB 72-1128-02 17-1198-01 PICKER CONTROL PCB 9-00659-01 2-00245-02 PICKER CONTROL PCB 72-1129-03 96-5334-01 DISPLAY ASSY 72-1125-01 17-1166-02 PD PCB 72-1134-03 96-5398-02 ROTARY PK, DLT 72-1134-04 96-5398-01 ROTARY PK, LTO 72-1261-01 96-...
本帖最后由 atiking 于 2010-12-16 17:33 编辑 起因是我看了这篇 http://coding.derkeiler.com/Archive/perl/comp.lang.perl.misc/2007-06/msg01421.html 于是我做了些修改[code]~/temp $ touch foo.1 foo.2 foo.3 ~/temp $ perl -le' for (1..10) { if (glob("foo.$_")) { print "yes" } else { print "no" } } ' yes no yes no yes no yes no yes no [/code]为什么呢,以我的理解结果应该是[code] yes yes yes no no no no n...
$array_length = scalar(@array); $time = scalar(localtime(time)); # !!! localtime返回的是数组,scalar何以如此智能返回时间的自然语言表达形式??!! 另,? = scalar(%hash);