#!/usr/bin/perl -w
use strict;
no strict "vars";
#
#  To move files from NEWlang into local places.
#
#  'WIll need to walk the tree of a language for the source tree, and detect
#   differences that would signal something should be preserved.[?] 
#   Usage" perl -w NEW2local <sourcelang> <destlang>
#
# TREAT THIS HASH TABLE AS AN IMPORTANT SECRET!:
%destlang = (
	"NEWlang" => "testlang",
	#"NEWlang" => "englishL",
	#"tr73m03k" => "chinEse",
	#"trAM19V8" => "spanishSA",
);

#
@args = ("date");
system(@args) == 0
  or die "system @args failed: $?";
#
#Identify the files in 1 test area:
@args = ("ls", "-al", "/home/darwind/public_html/tr73m03k/makepublic");  
system(@args) == 0
  or die "system @args failed: $?";

#foreach $key (%destlang) {
	@args = ("ls", "/home/darwind/public_html/tr73m03k/makepublic");    
	@filestomove = `@args`;

foreach $file2move (@filestomove) {
	chomp $file2move;
	open(FILEN, "/home/darwind/public_html/tr73m03k/makepublic/$file2move") 
	  or die "Can't open /home/darwind/public_html/tr73m03k/makepublic/$file2move\n";
	while (<FILEN>) {
		if ($. == 1) {
		  print "First line of $file2move is $_\n";
		};
		if ($. == 2) {
		  print "Copying rest of $file2move to targetofmove/$file2move\n";
		  open(FILEO, ">>", "/home/darwind/public_html/tr73m03k/targetofmove/$file2move") 
			or die "Can't open /home/darwind/public_html/tr73m03k/targetofmove/$file2move\n";
		};
		if ($. >= 2) {
		  print FILEO "$_";
		};
  	};
	close(FILEN);
};
#};  # End of all transcoded languages
