Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] if syntax problem?

Expand Messages
  • Nathan.Jeffrey@dhs.vic.gov.au
    I think that... if ($monthflag = 1){$day2test = 2002%d%d , $nextmonth, $day2;} ...should read... $day2test = sprintf( 2002%d%d , $nextmonth, $day2) if
    Message 1 of 6 , Sep 4, 2002
      I think that...

      if ($monthflag = 1){$day2test = "2002%d%d", $nextmonth, $day2;}

      ...should read...

      $day2test = sprintf("2002%d%d", $nextmonth, $day2) if monthflag == 1;

      Two things - comparisons are '==' or 'eq' (for strings), not '='. And
      sprintf is the function to put C-style printf into strings :-)


      "Evan Dembskey" <evan@...>
      04/09/2002 07:04 PM
      Please respond to perl-beginner

      To: "Perl-Beginner" <perl-beginner@yahoogroups.com>
      Subject: [PBML] if syntax problem?


      What is wrong with my syntax here? I keep getting a "Useless use of a
      variable in void context at lotfix.pl line 57." error.

      $monthflag = 0;
      $nextmonth = 0;
      @months = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
      $temp2 = $months[$date];
      $temp3 = $temp2 + 1;
      if ($lastdate > $temp2){$monthflag = 1; $nextmonth = $date + 1;}

      #build day1
      $day1 = $firstdate;
      $day1test = "2002%d%d", $date, $day1;

      #build day2
      $temp = ($temp2 + $lastdate -4);
      if ($temp > $temp3){$temp = $temp - $temp3;}
      $day2 = $temp;
      if ($monthflag = 1){$day2test = "2002%d%d", $nextmonth, $day2;} #This
      line 57
      else {$day2test = "2002%d%d", $date, $day2;}



      Unsubscribing info is here:

      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


      This email contains confidential information intended only for the person named above and may be subject to legal privilege. If you are not the intended recipient, any disclosure, copying or use of this information is prohibited. The Department provides no guarantee that this communication is free of virus or that it has not been intercepted or interfered with. If you have received this email in error or have any other concerns regarding its transmission, please notify Postmaster@...
    Your message has been successfully submitted and would be delivered to recipients shortly.