use Win32; use Cwd; print<; foreach ( @files ) { print "$_\n"; &checkFile( $_ ); } print "\ndone.\n"; print "\nScript done.\n"; sub query { my ($question) = @_; my $reply; print "$question "; chomp( $reply = ); return $reply; } sub checkFile { my ($file) = @_; open( IN, $file ) || (print STDERR "ERROR: cannot read $file\n", next); my @data = ; close IN; foreach ( @data ) { if (/^\s*package\s*$sourcePackage\s*;$/) { print " - repackaged: old: $_"; $_ = "package $destPackage;\n"; print " new: $_"; } if ( /^\s*import\s*/ && /$oldSub/) { print " - import fixed: old: $_"; s/$oldSub/$newSub/; print " new: $_"; } } open( OUT, ">$file" ) || (print STDERR "ERROR: cannot write $file\n", next); print OUT @data; close OUT; }