My Opera is closing 1st of March

simple

Subscribe to RSS feed

我的perl学习笔记,文件的读写

  1. 打开一个文件
    open (filevar, filename);
    open(FILE1, "/u/jqpublic/file1");
    
  2. 从打开的文件中读取
    $line = <MYFILE>;
    
  3. 立刻中止程序
    die (message);
    
  4. 写入一个文件
    open(OUTFILE, ">outfile");
    print OUTFILE ("Here is an output line.\n");
    
  5. 关闭文件
    close (filevar);
    
  6. 文件测试操作
    Operator Description  
    -b Is name a block device?  
    -c Is name a character device?  
    -d Is name a directory?  
    -e Does name exist?  
    -f Is name an ordinary file?  
    -g Does name have its setgid bit set?  
    -k Does name have its "sticky bit" set?  
    -l Is name a symbolic link?  
    -o Is name owned by the user?  
    -p Is name a named pipe?  
    -r Is name a readable file?  
    -s Is name a non-empty file?  
    -t Does name represent a terminal?  
    -u Does name have its setuid bit set?  
    -w Is name a writable file?  
    -x Is name an executable file?  
    -z Is name an empty file?  
    -A How long since name accessed?  
    -B Is name a binary file?  
    -C How long since name's inode accessed?  
    -M How long since name modified?  
    -O Is name owned by the "real user" only?*  
    -R Is name readable by the "real user" only?*  
    -S Is name a socket?  
    -T Is name a text file?  
    -W Is name writable by the "real user" only?*  
    -X Is name executable by the "real user" only?*  
    * In this case, the "real user" is the userid specified at login, as opposed to the effective user ID, which is the userid under which you currently are working. (On some systems, a command such as /user/local/etc/suid enables you to change your effective user ID.)  
    
  7. 读取一组文件
    $list = <>;
    
  8. 用命令行参数做变量
    $var = $ARGV[0];
    
  9. 打开管道
    open (MYPIPE, "| cat >hello");