Hi all list. I'm attempt to write a perl script for to migrate from bind dns to djbdns all my new incoming domains, the scenario is as follow: In the production environment I have on 2 servers a folder that contain request from people for domains activation, the informations for the request domain are mantained in a text file on this form:
[root@magellan mydocuments]# cat D0001102.txt saffiot.it; <--- the domain name webtu02; <--- the webserver for the website mail01-ichi; <--- the mail server disigned and for that's part all was fine because i'm write a script that read from this file the informations and write in another what I need and also a string that identify the domain, the alias for the web server & the mail address. the script is as follow: [root@magellan mydocuments]# cat translation.pl #!/usr/bin/perl -w open (MYFILE, '</home/gsaffioti/mydocuments/not_processed_users/D0001102.txt') || &error ; sub error { print "cannot stat\n"; } @array=<MYFILE>; if (@array > 0) { open (SOA, ">/home/gsaffioti/mydocuments/data"); $soa="$array[0]"; chop ($soa); $soa=~ s/;/:80.18.33.190:86400:a/; print SOA ".$soa\n" ; close (SOA); open (SOA2, ">>/home/gsaffioti/mydocuments/data"); $soasl="$array[0]"; chop ($soasl); $soasl=~s/;/:80.18.33.189:86400:b/; print SOA2 ".$soasl\n"; close (SOA2); open (MAIL, ">>/home/gsaffioti/mydocuments/data"); $mail="$array[0]"; chop ($mail); $mail=~ s/;/:80.18.33.190:a/; print MAIL "\@$mail\n"; close(MAIL); open (EQU, ">>/home/gsaffioti/mydocuments/data"); $equ="$array[0]"; chop $equ; $equ=~ s/;/:80.18.33.181:86400/; print EQU "+www.$equ\n"; close(EQU); close (MYFILE); } ------------------------------------------------------------- And this is the data file : [root@magellan mydocuments]# cat data .saffiot.it:80.18.33.190:86400:a .saffiot.it:80.18.33.189:86400:b @saffiot.it:80.18.33.190:a +www.saffiot.it:80.18.33.181:86400 So you can see that the script work for only 1 file. But if I trye to add the part that must read all files in a directory that contain all other files this script drive me grazy! because i receive an error that don't know why exist!. the part that I attempt to add is as follow: #!/usr/bin/perl -w opendir (DIR, '/home/gsaffioti/mydocuments/not_processed_users') || &error; @dir= readdir (DIR); close (DIR); if (@dir) { print "Start Distillation Process for domains wait plz:\n"; foreach $file (@dir) { print "$file\n" unless ($file=~/^\.+$/); open (MYFILE, '</home/gsaffioti/mydocuments/not_processed_users/$file') || &error; @array=<MYFILE>; &processing; ###this recall the previous code for the file reading. } sub error{ print "stopped here\n"; } sub processing{ here all the previous code whithout the handle MYFILE for the specific file that now become MYFILE for $file and i'm here not sure!!!. So now if I run the script this error occur: [root@magellan mydocuments]# ./filehandle.pl Start Distillation Process for domains wait plz: stopped here readline() on closed filehandle MYFILE at ./filehandle.pl line 15. stopped here readline() on closed filehandle MYFILE at ./filehandle.pl line 15. D0001102.txt stopped here readline() on closed filehandle MYFILE at ./filehandle.pl line 15. Seem that I attempt to write on a close filehandle but nothing is changed in the other code that can close the filehandle is the $file variable that is wrong? or what. Anybody know whereis the trouble?? I'm tryed and retryed Please help! my knoledge is finish! Thanks in advance to all & sorry for my ugly english! Goffredo Saffioti. Exit 1!!!! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]