一.打开.关闭文件 open的返回值用来确定打开文件的操作是否成功,当其成功时返回非零值,失败时返回零,因此可以如下判断: if (open(MYFILE, "myfile")) { # here is what to do if the file opened successfully } 当文件操作完毕后,用close(MYFILE); 关闭文件. 读:open(文件句柄,"<文件名") open(文件句柄,
1.perl 输出时,使用 逗号,连接多个字符串 如:print “The answer is ”,6*7, “.\n” 2.当一个字符串由双引号括起来时,如果变量前没有反斜线,则变量会被其值内插 $mean = “brontosaurus steak”;$barney = “fred ate a $meal”; #$barney 现在是“fred ate a brontosaurus steak” $barney = ‘fred ate a’. $meal; #同上 变量内插通常也叫做双引号内