Perl で第一引数のファイルを取り出すルーチン
Perl で第一引数のファイルを取り出すルーチンをパッケージ化
#!/usr/bin/perl package ishida;
sub argcut{
my($file) = @_;
if(-e $file){
if($file =~ /(\w+)\.(\w+)$/){
$newfile = $1.".csv";
}
else{x
$newfile = $file.".csv";
}
}
else {
print "cant find $file\n";
}
return $newfile;
}
呼出し側では
#!/usr/bin/perl require "ishida.pl"; $input = ishida::argcut($ARGV[0]);
Link: Programming(5617d)
Last-modified: 2007-10-02 (火) 12:40:24 (6683d)