Thanks to all awesome MONKS;
I got it solved :-) Yes one monk (anonymous) suggested ">>The array is never cleared from file to file". This thing worked for me. so my final code is (am not using all suggestions, so following codes work fine)
use warnings; use strict; use List::Util qw/ min max sum /; my $a = -55; my $b = -54; my $c = -55; my $d = -54; for (1..110) { my $file = "x_$a\_to_$b\_y$c\_to_$d"; open(my INFILE, '<', $file) or die "opening '$file': $!"; my @column8; # FRESH, NEW, EMPTY ARRAY for each file! ## YES defining here again my @column8 is very good while(<INFILE>){ push @column8, (split(/\s+/, $_))[7]; } $ZMAX = max @column8; $ZMIN = min @column8; $thick = $ZMAX - $ZMIN; print "$thick\n"; $c++; $d++; }
thanks to all other monks also
In reply to Re^2: how to make variable forget its previous value?
by sagar123
in thread how to make variable forget its previous value?
by sagar123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |