I am trying to run the following programme: the programme runs till line 156 as expected opens the file in $corresonedname but when it goes to line 185 just comes ut ogf the while loop after executing it only once, although the file it is reading is having 3308 lines!! with new line charcter at the end of every line...
#!/usr/local/bin/perl print("\n \nWelcome !! Please input the response very carefully in thi +s programme whenever asked for \n Now please ensure that before running +the programme you have run the vp29apr programme for the corresponding hou +r & also the 1d files for the j or t hour as applicable are has also been +run upon \n Now please enter the hour for which you want to check the data quality (a,b,..x) \n?" ); $hour=<STDIN>;chop($hour); print("you entered ", $hour ,"\n"); $comparison=3;@arrone=();@arrtwo=(); @array=("o","p","q","r","s","u","v","w","x","a","b"); if ($hour eq "j") { $comparison=$hour; } elsif($hour eq "t") { $comparison=$hour; } else { for($n=0;$n<=10;$n++) { if($array[$n] eq $hour) { $comparison="t"; } } } if($comparison ne "t") { if($comparison ne $hour) { $comparison = "j"; } } print("\n the value of comparison is ", $comparison ,"\n"); print ("\n Please enter the allocation no. from which you want to chec +k the data (1-60) \n"); $allocin=<STDIN>;chop($allocin); print ("\n",$allocin,"\n"); #goto LABELEND; for ($alloc=$allocin;$alloc<=60;$alloc++) { print ("\n",$alloc,"\n");#goto LABELEND; $i=0;$m=0;$p=0; print ("\n We are checking data quality for hour=",$hour," Alocation=",$alloc,"\n"); $astatname="/tmp_mnt/usr4/mrt/vinayPandey/name".$alloc.$hour."1.astat" +; $onedname="/tmp_mnt/usr4/mrt/vinayPandey/name".$alloc.$hour."1.1d" ; print("\nastatname= ",$astatname,"\nonedname=",$onedname,"\n"); if (open(NAMEAS, $astatname)) { print ("I am inside the first loop\n"); while(<NAMEAS>) { ($arrone[$i],$arrtwo[$i])=split(' '); print ("\n",'arrone[',$i,']=',$arrone[$i],' arrtwo[',$i,']=', +$arrtwo[$i],"\n"); $i++; } } close(NAMEAS); $n[1]=$i-1; if (open(NAMEONED,$onedname)) { while(<NAMEONED>) { ($arrthree[$m],$arrfour[$m])=split(' '); print ("\n We are in the second loop \n"); print ("\n",'arrthree[',$m,']=',$arrthree[$m],' arrfour[',$m,']=',$ar +rfour[$m],"\n"); $m++; } } $n[2]=$m-1; close(NAMEONED); $/="astat.gz";$k=0; for($p=0;$p<=$n[1];$p++) { chomp($arrone[$p]); print ("\n",'arrone[',$p,']=',$arrone[$p],"\n"); $corresonedname=($arrone[$p]."1d");$arrone[$p]=$arrone[$p]."astat.gz" +; print("\n corresonedname name is=",$corresonedname,"\n"); if ( -e $corresonedname ) { print (" \n file $corresonedname exists"); for($j=0; $j<=$n[2];$j++) { print("\n corresonedname=",$corresonedname," arrthree[",$j,"]=",$arrt +hree[$j],"\n"); if ( $corresonedname eq $arrthree[$j]) { print("\n $corresonedname $arrthree[$j] the value of j=$j"); $arronestore[$k]=$arrone[$p]; $arrtwostore[$k]=$arrtwo[$p]; $arrthreestore[$k]=$arrthree[$j]; $arrfourstore[$k]=$arrfour[$j]; #use PGPLOT; # Load PGPLOT module #print "\nTesting simple point plot...\n\n"; #print "PGPLOT module version $PGPLOT::VERSION\n\n"; #pgqinf("VERSION",$val,$len); #print "PGPLOT $val library\n\n"; # "?" will prompt for device #$dev = "?" unless defined $dev; #pgbegin(0,$dev,1,1); # Open plot device #pgscf(2); # Set character font #pgslw(4); # Set line width #pgsch(1.6); # Set character height $response="h";$y1=0;$y2=70;$r="f";$ab1=0; while ($response ne "y") { @arrsidtime=("a","b","c","d","e","f","g","h","i", "j","k","l","m","n","o","p","q","r","s","t","u","v","w","x"); if ($r eq "f") { while( $hour ne $arrsidtime[$ab1]) { ++$ab1;$ab2=$ab1 + 1;$r="t"; } } #pgenv($ab1,$ab2,$y1,$y2,0,0); # Define data limits and plot axes #pglabel("X","Y","Data"); # Labels #pgsci(5); # Change colour # nlkwqjdexit; print("everything is right...."); if (open(NAME ,"$corresonedname")) #{ # print ("\n\n the file",$corresonedname," has been opened","\n"); #@infile = <NAME>; #print "@infile"; #print"\n"; #$x[0]=<NAME>; #print $x[0]; #print ("\n $x"); #$x = @infile; #print("number of fields ", $x, "\n"); #while(<NAME>){ #($ag, $ah, @ag1 ) = split(' ',@infile,3); print("check ", $ag, "ah" +, $ah, "\n"); #print ("\n ",@ag1); #print($infile[0]); #exit; #} #} { print ("\n\n the file",$corresonedname," has been opened...."); #exit; #$abc=<NAME>; #print $abc; #goto LABELEND; $g=0; while(<NAME>) { print ("\n THE value of J is=",$j,"\n"); print("reading..",$corresonedname,"\n"); # Read data in 2 columns from file handle # and put in two perl arrays ($y[$g],$x[$g]) = split(' '); #print("\n",$x[0],"\n"); #print("\ny=",$y[0],"\n z=",$z[0]); $g++; #$abc=<NAME>; } print("\n khadfhakfh AAAA"); if( $j==5) { #$aj=@x; print("the value of ele=",$x[5],"\n"); exit; #print("\n",$x[0],"\n"); #print("\n value of x=",$x[0]); print("\nYes it comes here from line 219\n response=",$response,"\n r= +",$r,"\n ab1=",$ab1,"\n g=",$g,"\n");goto LABELEND;} print ("\n",$g,"\n"); # Plot points - note how perl arrays are passed #pgpoint($g,\@x,\@y,17); #pgend; close (NAME); } $response="yn"; print("\n enter your reply\n"); $response=<STDIN>; chop($response); print ("you entered ",$response,"\n"); goto LABELEND; if ($response eq "n" ) { print ("\n Please enter Xmin value\n"); $ab1=<STDIN>;chop($ab1); print ("\n Please enter Xmax value\n"); $ab2=<STDIN>;chop($ab2); print ("\n Please enter Ymin value\n"); $y1=<STDIN>;chop($y1); print ("\n Please enter Ymax value\n"); $y2=<STDIN>;chop($y2); } } print("\n please Give the quality factor\n"); $quality[$k]=<STDIN>;chop($quality[$k]); if ($comparison eq $hour) { $k++; goto NEXTLINE; } else { print ("checking the data etc... if $ quality response is not 1 for + both file + calibarator it will just go to next file.. as here for ex.. +.\n"); # if qualit is one for both it prints the things in output file go +es # to the #next allocation else it just comes out of the loop.. $k++;goto NEXTLINE; } } print ("\n Hi Hi $j thtime no match value of j=$j\n arrthree= $arrth +ree[$j] \n the value of corresonedname= $corresonedname \n"); } } else { print ("\n we are not able to find file",$corresonedname,"\n"); } NEXTLINE: } if ( $comparison eq $ hour) { print ("\n here write all the files in good data output file note in one go for one allocation(60 for the whole hour & in each file many + file\n"); print ("it now goes to the next allocation\n"); goto NEXTLINETWO; } else { print ("\n here the actual test starts i.e. comparison etc.....\n" ); } NEXTLINETWO: } LABELEND: print("\n this is the end of the programme\n");

In reply to debug the error!!! by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.