@ls = `ls *.txt`; chomp @ls; foreach$file(@ls){ $file_utf8 = $file; $file_utf8 =~ s/\.(.*)?$//; $file_utf8.= ".utf8"; system("nkf -w $file > tmp"); system("mv tmp $file_utf8"); print "nkf -w $file > tmp\n"; }
use File::Find; @ARGV = qw(.) unless @ARGV; find sub { push @list, $File::Find::name, -d && '/', "\n"}, @ARGV; chomp @list; foreach(@list){ unless($_){next;} if(/^\//){next;} print "nkf -w $_ > tmp\n"; system("nkf -w $_ > tmp"); system("mv tmp $_"); }