• 文件操作符|-e|-M|-s|-A|_|-r -w $filename|stat|localtime|&|>>|<<


    TTY:终端是一种字符型设备,它有多种类型,通常使用tty 来简称各种类型的终端设备

     1 #!/usr/bin/perl
     2 
     3 use strict;
     4 use warnings;
     5 
     6 print "exist!
    " if -e '1.txt';
     7 print "exist!
    " if -e '2.txt';
     8 
     9 #exist!
    10 #
    11 
    12 warn "new file!
    " if -M '1.txt' < 2;
    13 
    14 #new file!
    15 
    16 my $filename = '1.txt';
    17 if((-s $filename <100_000) &&(-A _ < 1)){print "this file is small and new!
    ";}
    18 if(-w -r _ ){print "this file is both writable and readable!
    ";}
    19 
    20 #this file is small and new!
    21 #this file is both writable and readable!
    22 
    23 my $file = -s $filename;print "file size is $file"."B
    ";
    24 
    25 #file size is 116B
    26 
    27 if (-l 'check.pl'){print "check.pl is a file with link
    "}
    28 
    29 #check.pl is a file with link
    30 
    31 my $M = -M '1.txt';my $C = -C 'check.pl';my $A = -A 'check.pl';print "$M	$C	$A
    ";
    32 
    33 #0.0313657407407407407   3.10847222222222222     3.10847222222222222
    34 
    35 $_ ='1.txt';if (-r){print "$_ is a readhandle
    "}
    36 
    37 #1.txt is a readhandle
    38 
    39 my $size = (-s)/1024;print "$size
    ";
    40 
    41 #0.11328125
    42 
    43 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat('1.txt');$atime = localtime $atime;
    44 my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst)=localtime $ctime;
    45 print "dev_number=$dev
    inode =$ino
    mode=$mode
    hard link=$nlink
    user id=$uid
    group id=$gid
    $rdev
    size=$size
    $atime
    $mtime
    $ctime
    $blksize
    $blocks
    ";
    46 print "$yday
    ";
    47 
    48 #dev_number=43
    49 #inode =95085688861
    50 #mode=33188
    51 #hard link=1
    52 #user id=1000092
    53 #group id=30086
    54 #0
    55 #size=116
    56 #Sun Jun 30 17:17:20 2019
    57 #1561886240
    58 #1561886240
    59 #1048576
    60 #8
    61 #180
    62 
    63 my $now =gmtime;print "$now
    ";
    64 
    65 #Sun Jun 30 11:10:25 2019
    66 
    67 my $two = 12&2;print "$two
    ";
    68 my $move = 25.5>>2;print "$move
    ";
    69 $move = (25>>2)<<2;print "$move
    ";
    70 
    71 #0
    72 #6
    73 #24
  • 相关阅读:
    mvc 注册脚本的其他方法
    如何将html代码转换为Xml并生成Dom树
    用TFIDF值来判断词的重要性
    oem key
    vs2010 下的ado.net 实体模型创建数据库时datetime 类型的问题
    asp.net mvc 动态注册脚本
    ASP.NET 中如何对生成的 HTML 内容流进行控制
    C# 子窗体调用父窗体的方法
    layui 弹出新页面
    winform excel导入进度条
  • 原文地址:https://www.cnblogs.com/yuanjingnan/p/11110852.html
Copyright © 2020-2023  润新知