Dear Monks,
I have an input file which has 4 entries per line. But I am not sure how many lines will be there in the input file.
Jakarta 30 indonesia 40
Beijing 50 China 20
I want to print out something like
1. Temperature in Jakarta is 30, but average temp in indonesia is 40 d
+egrees.
2. Temperature in Beijing is 50, but average temp in China is 20 degre
+es.
I am not sure how to save the 4 words and split them using delimiter so that I can actually use them somewhere. I think I am way off in the coding part, since I am new to perl. This is what I wrote, but this doesnt work.
open(my $fh, '<', 'Citytempfile.txt')
or die "Cannot open cellnames.txt: $!";
my $i = 0
while (<$fh>) {
my @array = split ' ', <$fh>
print $fileHandle_drc $i+1, 'Temperature in ',$array[0], ' is ', $arr
+ay[1], 'but average temp in ', $array[2], 'is', $array[3] ;
$i++;
}