#!/usr/bin/perl
use warnings
open (INPUTF, $ARGV[0]) or die "can not open $ARGV[0] file"
open (OUTPUTF, ">$ARGV[1]") or die "can not open $ARGV[1] file"
$i=0
while ( <INPUTF>) {
last if ( $ARGV[2] == $i )
$i++
}
if ( $ARGV[2] == $i ) {
@cons=split(/(?=[\w\W])/)
if ( @cons >$ARGV[3] ) {
printf(OUTPUTF "%s", $cons[$ARGV[3]-1])
} else {
print "the $ARGV[2] lines do NOT have $ARGV[3] characters!\n"
}
} else {
print "$ARGV[0] do NOT have $ARGV[2] lines\n"
}
close INPUTF
close OUTPUTF
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)