为了让贴出来的代码符号正确开头空格也正确写的perl脚本

#!/usr/bin/perl
 
 open(TMPFILE,"$ARGV[0]")||die "error";
 open(SHOWFILE,"+>$ARGV[0].txt")||die "error";
 while($line=<TMPFILE>)
{
 $line =~ s/(\S)/$1/;
 $line =~ s/\n/<\/code>$&/;
 $line =~ s/^\s+//;
 $tmp= $&;
 $tmp=~ s/\n//g;
 $tmp=~ s/[ \t]/&nbsp;/g;
#print "$tmp\n";
 $line= $tmp.$line;
 print $line;
}
close(TMPFILE);
close(SHOWFILE);

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*


为了防止恶意的垃圾评论脚本,请输入以下图片里面的数学方程式的答案。
防垃圾评论问题