[Perl]备忘录。

【不断补充中...】

1. 转换大小写

 

my $str = 'ifeq ($(strip $(RELEASE_PROJECT_VERNO),K520M00_PR1)'; #/L 为转为LowerCase #/U 为转为UpperCase if ( $str =~ s/(/w+)//L$1/g ) { say $str; }

2. 输入输出

    1)文件句柄:

open LOG, "log.txt";#输入输出 open LOG, "< log.txt";#输入 open LOG, "> log.txt";#覆盖 if ( open LOG, ">> log.txt”)#追加 { print LOG "Debug strings.../n"; } else { die "Can't open logfile:$!" ; } #改变默认输出文件句柄: select LOG; $| = 1 ;#output directly ,not through buffer print LOG "Defautl to print to LOG./n"; select STDOUT; close LOG;

     内置文件句柄:

     STDIN/STDOUT/STDERR/DATA/ARGV/ARGOUT

    2)标准输入输出:

 

while ( defined($_ = <STDIN> )) { print $_; }

3.

你可能感兴趣的:(perl,buffer)