Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
(Note, i reposted this in response to How (Not) To Ask A Question merely because i was curious as to what the code actually looked like)
I am trying to run the following programme but the following errors ar +e being complained which I am not able to sort it out!!! syntax error at checkdataperl.p line 249, near "for" syntax error at checkdataperl.p line 250, near "++) " syntax error at checkdataperl.p line 286, near "}" Execution of checkdataperl.p aborted due to compilation errors. Dear Monks pls help me??? #!/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 and 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=;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=;chop($allocin); print ("\n",$allocin,"\n"); 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 = "/xw" 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 #pgask(false); for ($alloc=$allocin;$alloc<=60;$alloc++) { print ("\n",$alloc,"\n"); $i=0;$m=0;$p=0; print "\n We are checking data quality for hour=$hour Alocation= $a +lloc \n"; $astatname="/tmp_mnt/usr4/mrt/vinayPandey/name".$alloc.$hour."1.astat" +; $onedname="/tmp_mnt/usr4/mrt/vinayPandey/name".$alloc.$hour."1.1d" ; if ($comparison ne $hour) { $caldet="/usr4/mrt/vinayPandey/caldet".$alloc.$comparison."1.1d"; open(CALDET,$caldet); $c2=0; $line=; while( $line ne "" ) {chop($line); ($calqone[$c2])=split(' ',$line,4); $line=; $c2++; } } if ((open(NAMEAS, $astatname)) && (open(NAMEONED,$onedname))) { while() { ($arrone[$i])=split(' '); $i++; } close(NAMEAS); $n[1]=$i-1; while() { ($arrthree[$m])=split(' '); $m++; } } $n[2]=$m-1; close(NAMEONED); $k=0; for($p=0;$p<=$n[1];$p++) { for($n=0;$n<=7;$n++) { chop($arrone[$p]); } $corresonedname=($arrone[$p]."astat.gz"; if ( -e $corresonedname ) { for($j=0; $j<=$n[2];$j++) { if ( $corresonedname eq $arrthree[$j]) { $arronestore[$p]; $arrtwostore[$p]; $arrthreestore[$j]; $arrfourstore[$j]; if (open(NAME ,"$corresonedname")) { $g=0; while() { # Read data in 2 columns from file handle # and put in two perl arrays chop(); ($y[$g]) = split(/\s+/); $g++; } print ("\ng=",$g,"\n"); close (NAME); } $response="h";$r="f";$ab1=0; while ($response ne "abcde") { @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") { $y1=0;$y2=0.1;$fmin=$y[0]; for ($s1=0;$s1<($g-1);$s1++) { if ($fmax < $y[$s1]) { $fmax=$y[$s1]; } if ($fmin > $y[$s1]) { $fmin= $y[$s1]; } } print ("\n ymax=",$fmax,"Ymin=",$fmin,"\n"); $y1=$fmin; $y2=$fmax; $y2=($y2+0.1); $y1=($y1-0.1); print ("\n y2=",$y2,"y1=",$y1,"\n"); 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",$corresonedname); # Labels pgsci(5); # Change colour pgline($g,\@x,\@y); print("\n please enter your response for the plot....\n FOR SEEING +THE PLOT WITH MODIFIED AXES PLEASE ENTER n \n OR GIVE THE APPROPRIA +TE QUALITY FACTOR FOR THE FILE FROM 1-9\n ?"); $response=; chop($response); print ("you entered ",$response,"\n"); if ($response eq "n" ) { print ("\n Please enter Xmin value\n"); $abr1=;chop($abr1); if ($abr1 ne "") {$ab1=$abr1;} print ("\n Please enter Xmax value\n"); $abr2=;chop($abr2); if ($abr2 ne "") {$ab2=$abr2;} print ("\n Please enter Ymin value\n"); $yr1=;chop($yr1); if ($yr1 ne "") {$y1=$yr1;} print ("\n Please enter Ymax value\n"); $yr2=;chop($yr2); if ($yr2 ne "") {$y2=$yr2;} } elsif(("123456789" =~ m/$response/) && ($response ne "")) { $quality[$k]=$response;$response="abcde"; print ("\n aulaity ",$k,"=",$quality[$k],"\n"); } else { print "\n please enter proper response\n"; } } if ($comparison eq $hour) { $k++; goto NEXTLINE; } else { $hdiffer = &get_RAdiff_fromsun($comparison,$arrthree[$k]); if (($quality eq "1") && ($hdiffer >= 2)) { $calfilename=&gencalfn($corresonedname,$comparison) if (-e $calfilename) { $c2=$c2-1; for($c3=0;$c3<=$c2;$c3=$c3++) { if(($calfilename eq $calqname[$c3]<=100)) { $gooddata="/usr4/mrt/vinayPandey/good".$hour; if (-e $gooddata) {open(FILE, ">>$gooddata"); } else { open(FILE,">$gooddata"); } $qnet=1; print FILE "$arrthreestore[$c3] $qnet \n"; close(FILE); $k++; goto NEXTLINE; } else { if ($calfilename eq $claname[$c3]) { $c2++; $k++; goto NEXTLINE; } } } } } $k++; goto NEXTLINE; } } } } else { print "\n we are not able to find file $corresonedname\n"; } NEXTLINE: } if ( $comparison eq $ hour) { print "\n +++ k= $k"; $k=$k-1;print "\n +++ k= $k"; $calname="/usr4/mrt/vinayPandey/caldet".$alloc.$hour."1.1d"; if (-e $calname) { open(CALNAME, ">>$calname"); } else { open(CALNAME, ">$calname"); } for($c1=0;$c1<=$k;$c1++) { $hdifference=&get_RAdiff_forsun($comparison,$arrthreestore[$c1]); if ($hdiffernce $c1]=$quality[$c1]+$W7; } print CALNAME "$arrthreestore[$c1] \n"; } close (CALNAME); } else { $k=$k-1; $c2=$c2-1; for($tak1=0;$tak1<=$k;$tak1++) { $calibname=&gencalfn($arrthree[$tak1],$comparison); $pos=&get_RAdiff_forsun($comparison,$arrthree[$tak1]); if (-e $calibname) {$W6=0;$factor="y";} else { $calibnamenew=$calibname; @newarr=("1a","2b","3c","4d","5e","6f","7g","8h","9i","10j","11k","12 +l","13m","14n","15o","16p","17q","18r","19s","20t","21u","22v","23w", +"24x"); for($st1=0;$st1<=6;$st1++) {chop($calibnamenew);} $b1=chop($calibnamenew); $b2=chop($calibnamenew); $b12=$b2.$b1; $jd1=chop($calibnamenew); $jd2=chop($calibnamenew); $jd3=chop($calibnamenew); $jday=$jd3.$jd2.$jd1; $nlm1=-1; $sn=chop($calibnamenew); $nl=0; while($nl != 5){ for ($ensure=1;$ensure<=2;$ensure++) {$nlm=$nlm1*$nl; $jday=$jday+$nlm; for ($na=1;$na<=4;$na++) { @subsubst=grep(/$na\S/,@newarr); $subsubst[0]); for ($nah=1;$nah<=24;$nah++) { @hoursubst=grep(/$nah\S/,@newarr); $hoursubst[0]); $caltestname=$calibnamenew.$subsubst[0].$comparison."1.1d"; if (-e $caltestname) { $calibname=$caltestname;$factor="y"; if ($nl=0) {$W6=0;} elsif($nl<=3) {$W6=3;} else{$W6=5;} goto CHECK; } } } if ($nl eq "0") {++$ensure;} } $nl++; } if ($factor ne "y") {$calibname=$calqone[$tak2];} CHECK: for ($tak2=0;$tak2<=$c2;$tak2++) { if ($calibname=$calqone[$tak2]) { if ($calqthree[$tak2]<=100){$W4=1;} elsif ($calqthree[$tak2]<=400){$W4=2;} else{$W4=3;} if ($arrtwostore[$k]<=100) {$W3=1;} elsif ($arrtwostore[$k]<=400) {$W3=2;} else {$W3=5;} if ($pos >= 4) { $W5=1; } elsif ($pos >= 2) { $W5=2; } else { $W5=5; } $netquality[[$tak2]+$W3+$W4+$W5+$W6; $calstoreone[$tak2]; $calstoretwo[$tak2]; $calstorethree[$tak2]; $calstorefour[$tak2]; goto FIRSTLOOP; } } } FIRSTLOOP: } print ("\n here the actual test starts i.e. comparison etc.....\n" ); } NEXTLINETWO: } LABELEND: pgend; print("\n this is the end of the programme\n"); sub gencalfn { local(@complex,$temp,$calib1,$val1,$val2,$tempx,$tempy,@tempxy,$val3,$ +calib2,$comparison,$val4); @complex=("1a","2b","3c","4d","5e","6f","7g","8h","9i","10j","11k","12 +l","13m","14n","15o","16p","17q","18r","19s","20t","21u","22v","23w", +"24x"); $calib1=$_[0]; $comparison=$_[1]; for ($temp=0;$temp<=3;$temp++) { chop($calib1); } $tempx=chop($calib1);print"\n $tempx==",$tempx; $tempy=chop($calib1);print"\n tempy==",$tempy; @val1=grep(/\d{1,2}$tempx/,@complex);print "\n val1==",$val1[0]; @val2=grep(/\d{1,2}$tempy/,@complex);print "\n val2==",$val2[0]; @val3=grep(/\d{1,2}$comparison/,@complex);;print "\n val3==",$val3[0]; chop($val1[0]);print "\n ",$val1[0]; if ($val1 $val3) {$val4=$val1-$val3;} if ($val2>$val4) { $val=$val2-$val4; @tempxy=grep(/$val\S/,@complex);print "\n ttt",$tempxy[0]; $tempxy[0]; $tempxy[0]; $calib2=$calib1.$tempxy[0]."1.1d"; } else{ if ($val1<$val3) {$val4=$val3-$val1;} elsif($val1>$val3) {$val4=24-$val1+$val3;} $val=$val2+$val4; @tempxy=grep(/$val\S/,@complex);print "\n ttt",$tempxy[0]; $tempxy[0]; $tempxy[0]; $calib2=$calib1.$tempxy[0]."1.1d"; } return ($calib2); } sub get_RAdiff_forsun{ local($jd,@daya_in_month,@avg_for_month;$RA,$change_in_jd,$shift_in_ye +ars,$comp,$value,$jd1,$jd2,$jd3,$jdtemp,$hourdiff,@arrcomp); @arrcomp=("1a","2b","3c","4d","5e","6f","7g","8h","9i","10j","11k","12 +l","13m","14n","15o","16p","17q","18r","19s","20t","21u","22v","23w", +"24x"); $comp=$_[0]; $jdtemp=$_[1]; for ($ltemp=0;$ltemp<=8;$ltemp++) {chop($jdtemp);} $jd3=chop($jdtemp); $jd2=chop($jdtemp); $jd1=chop($jdtemp); $jd=$jd1.$jd2.$jd3; @days_in_month = (31,28,31,30,31,30,31,31,30,31,30,31); @avg_for_month = (254,234,220,225,236,247,240,225,216,223,244,254) +; #$jd = "244" . "$jd" if( $jd >= 9000 ); #$jd = "245" . "$jd" if( $jd = 365 && $change_in_jd <= 730) { $shift_in_years = 1; $change_in_jd = $change_in_jd - 365; $RA = $RA - 60; $days_in_month[1] = 29; } if($change_in_jd > 730) { $change_in_jd = $change_in_jd - 731; $shift_in_years = 2 + (int($change_in_jd / 365)); $change_in_jd = $change_in_jd % 365; $RA = $RA + 240 - ($shift_in_years * 60); } for($i=0;$i $days_in_month[$i]) { $RA = ($RA + ($days_in_month[$i])) % 86400; $change_in_jd = $change_in_jd - $days_in_month[$i]; } else { $RA = ($RA + ($avg_for_month[$i]*$change_in_jd)) % 86400; } } $value=(grep(/\d{1,2}$comp/,@comp))-0.5; if ($RA >$value) { $hourdiff=$RA-$value;} else{$hourdiff=$value-$RA;} return($hourdiff); }

In reply to Re: find the syntax error!!! by BUU
in thread find the syntax error!!! by Anonymous Monk

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [hippo]: See also Getting Started with Perl for some gentle introductory tutorials.

    How do I use this? | Other CB clients
    Other Users?
    Others avoiding work at the Monastery: (7)
    As of 2018-02-21 09:54 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (276 votes). Check out past polls.