Irenta wrote:
ok it started working and now that I run it in another computer is doing the same thing. I added -w at the top and it is giving me the following errors:
-w will give you warnings not errors.
Use of uninitialized value in division (/) at ./filegroupfix1_1000.txt line 133, <V10> line 61410. Use of uninitialized value in printf at ./filegroupfix1_1000.txt line 136, <V10> line 61410. Error opening file. at ./filegroupfix1_1000.txt line 15, <V10> line 136506. Useless use of a constant in void context at ./filegroupfix1_1000.txt line 149. The script is below.***
It is hard to tell from the program where lines 15, 133, 136 and 149 are because the email program wraps long lines.
Can anyone tell me what am I missing? I'll appreciate your help. Thanks, Isha *** ---------------- #!/usr/bin/perl -w #open the data files @fcsttime=( '00', '06', 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72); @inittime=('10. 00', '10. 06', '10. 12', '10. 18', '11. 00', '11. 06', '11. 12', '11. 18', '12. 00', '12. 06', '12. 12', '12. 18', '13. 00'); [EMAIL PROTECTED]( '0000', '0600', '1200', '1800'); for($j=0;$j<=13;$j++) { open (GFDLU,'<',"26Uivan09l.2004091000.gribn3.f $fcsttime[$j].UGRD.txt") || die "Error opening file."; open (GFDLV,'<',"26Uivan09l.2004091000.gribn3.f $fcsttime[$j].VGRD.txt") || die "Error opening file."; open (GFDLP,'<',"26Uivan09l.2004091000.gribn3.f $fcsttime[$j].PRMSL.txt") || die "Error opening file."; open (GFDLT,'<',"26Uivan09l.2004091000.gribn3.f $fcsttime[$j].TMPsfc.txt") || die "Error opening file."; open (GFDLR,'<',"26Uivan09l.2004091000.gribn3.f$fcsttime[$j].RH.txt") || die "Error opening file."; open (GFDLH,'<',"26Uivan09l.2004091000.gribn3.f$fcsttime[$j].HGT.txt") || die "Error opening file.";
Your error message "Error opening file." makes it difficult to tell which file couldn't be opened and the reason that it couldn't be opened. You should include the file name and the $! variable in the error message.
open GFDLH, '<', "26Uivan09l.2004091000.gribn3.f$fcsttime[$j].HGT.txt" or die "Error opening '26Uivan09l.2004091000.gribn3.f$fcsttime[$j].HGT.txt' $!";
#assign the data files to a list @lgfdlp=<GFDLP>; @lgfdlu=<GFDLU>; @lgfdlv=<GFDLV>; #20 @lgfdlt=<GFDLT>; @lgfdlr=<GFDLR>; @lgfdlh=<GFDLH>;
[ SNIP ]
for($i=0;$i<3600;$i++) { #100 printf "04 0409$inittime[$j]00"; $fcontentlat=$lgfdllat[$i]; printf (" %7.3f",$fcontentlat); $fcontentlon=$lgfdllon[$i]; printf ("%8.3f",$fcontentlon); $pressv=$lgfdlp[$i]/100;
"Use of uninitialized value in division" means that the value of $lgfdlp[$i] is undef.
printf (" %6.1f",$pressv); $fcontentt=$lgfdlt[$i]; printf (" %6.1f",$fcontentt);
"Use of uninitialized value in printf" means that the value of $fcontentt is undef.
$fcontentr=$lgfdlr[$i]; printf (" %6.1f",$fcontentr); $fcontenth=$lgfdlh[$i]; printf (" %6.1f",$fcontenth); $U10m=$U10m2[$i]; printf ("%6.1f",$U10m); $V10m=$V10m2[$i]; printf (" %6.1f",$V10m); print " GFDL\n"; } #120 close(GFDLU,GFDLV,GFDLH,GFDLR,GFDLT,GFDLP,LATI,LONI,U10M,V10M,ALLF)
close() can only close *one* filehandle so you get the warning "Useless use of a constant in void context" for all the other filehandles.
}
John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/