@string=qw(7 6 5 4);
print join('',sort @string);
print"\n";
@string2=qw(a b c A B C);
print join('',sort @string2);
4567
ABCabc
字母按ASCII排,数字也会按升序排
if(open(null,"c:\\Open_Perl_IDE_1.0.11.409\\test1.pl"))
{
print "yes!"
}
else
{
print "no!"
}
Open函数,prar1是文件句柄,para2是文件完整路径,如果不是完整路径,只指定一个文件名,那么open将在程序当前目录下寻找该文件
open(null,"test1.pl")
关于while句柄
open(file,"test1.pl")||die;
while($a=
{
print $a;
}
while(
{
print $_;
}
这两段while是等效的,当while判断句柄时,会自动把句柄赋给$_,最后不能忘了关掉句柄close(file),养成好习惯 :)
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11517198/viewspace-553610/ ,如需转载,请注明出处,否则将追究法律责任。