标签:perl
1.文件读写与命令行参数
#!/usr/bin/perl
use strict;
if (@ARGV < 2){
die "USAGE: perl $0 inputfile outfile\n";
}
my ($infile) = @ARGV[0];
my ($outfile) = @ARGV[1];
open my $infile_fh,‘‘, "$infile" || die("Can‘t open the file!");
open my $outfile_fh, ‘>>‘, "$outfile"|| die("Can‘t open the file!");
while(<$infile_fh>){
#chomp;
print $outfile_fh $_;
}
close($outfile_fh);
close($infile_fh);
本文出自 “yiyi” 博客,请务必保留此出处http://heyiyi.blog.51cto.com/205455/1596188
标签:perl
原文地址:http://heyiyi.blog.51cto.com/205455/1596188