考虑下面的Perl脚本script.pl作为示例:
use strict;
use warnings;
sub f1
{statements}
sub f2
{statements}
sub f3
{statements}
f1();f2();f3();
Run Code Online (Sandbox Code Playgroud)
当我执行脚本时,它应该显示如下输出:
./script.pl
子程序数:3个子程序
名:f1 f2 f3
考虑以下代码,例如:
@array=(1..10);
print @array;
print "@array";
The output is as follows:
12345678910
1 2 3 4 5 6 7 8 9 10
Run Code Online (Sandbox Code Playgroud) 以下两种文件创建方式有何不同?
open(DATA,">newfile.txt"); #1.using open function
close(DATA);
`touch newfile.txt`; #2.using touch command
Run Code Online (Sandbox Code Playgroud)
哪一个好又快?注意:当在Perl脚本中使用open function和touch命令时,并考虑将其用于创建空文件.
我编写了一个Perl脚本并放在Linux/Windows机器上,并希望限制它
如果管理员使用记事本打开程序,那么他们将看到整个文件
如果非管理员用记事本打开程序,那么他们应该只看到30%的内容