Oh la la.... You have no error checking at all. Start with putting some 'or die "blah: $!"' after the calls to open. When it's working, add use strict; use warnings; to the top of the code and declare variables with my as necessary. Get rid of the global variables like @fields within the subroutines. Replace open FILE1 by open my $file1. Replace the blobs of ifs with hashes (%langname = (English => 'en', Indonesian => 'id', etc...);).
in reply to Script runs from command line but not via crontab