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

Re: [PBML] Using maths in print statement..

Expand Messages
  • cgiperl
    How about using eval() printf The desired value is .eval($count - 1); Aman Raheja AGF Technologies http://www.agftech.com ... -- Your favorite stores,
    Message 1 of 5 , Nov 4, 2003
    • 0 Attachment
      How about using eval()
      printf "The desired value is ".eval($count - 1);

      Aman Raheja
      AGF Technologies
      http://www.agftech.com


      Charles K. Clarkson wrote:

      > Sreeram B S <sreeramabsc@...> wrote:
      > :
      > : Thanks for the answer.. but this method was known !!!
      >
      > Almost all answers you'll find here are known
      > methods.
      >
      >
      > : This method uses an extra variable.. $temp in the
      > : example quoted.. I just wanted a means of avoiding
      > : this extra variable.
      >
      > How about using 'printf'. Just replace your variable
      > with %s and move it to the end. Later, you can dig into
      > the documentation to find out how to use formats beyond
      > %s. BTW, there is no need to put a space at the end of
      > a line.
      >
      >
      > my $count = 5;
      > printf "The desired value is (%s)\n", $count - 1;
      >
      >
      > HTH,
      >
      > Charles K. Clarkson
      > --
      > Head Bottle Washer,
      > Clarkson Energy Homes, Inc.
      > Mobile Home Specialists
      > 254 968-8328
      >
      >
      > Yahoo! Groups Sponsor
      > ADVERTISEMENT
      > click here
      > <http://rd.yahoo.com/M=194081.4074964.5287182.1261774/D=egroupweb/S=1705006951:HM/A=1732163/R=0/SIG=11n0nglqg/*http://www.ediets.com/start.cfm?code=30510&media=zone>
      >
      >
      >
      > Unsubscribing info is here:
      > http://help.yahoo.com/help/us/groups/groups-32.html
      >
      > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
      > <http://docs.yahoo.com/info/terms/>.


      --
      Your favorite stores, helpful shopping tools and great gift ideas.
      Experience the convenience of buying online with Shop@Netscape!
      http://shopnow.netscape.com/

      --
      Your favorite stores, helpful shopping tools and great gift ideas.
      Experience the convenience of buying online with Shop@Netscape!
      http://shopnow.netscape.com/



      [Non-text portions of this message have been removed]
    • Charles K. Clarkson
      ... I assume you mean print not printf. You re leaving the newline off the end in your solution. But why use eval()? What purpose does it serve? What advantage
      Message 2 of 5 , Nov 4, 2003
      • 0 Attachment
        For some reason Aman <amancgiperl@...> wrote:

        : Charles K. Clarkson wrote:
        :
        : > Sreeram B S <sreeramabsc@...> wrote:
        : > :
        : > : This method uses an extra variable.. $temp in the
        : > : example quoted.. I just wanted a means of avoiding
        : > : this extra variable.
        : >
        : > How about using 'printf'. Just replace your variable
        : > with %s and move it to the end. Later, you can dig into
        : > the documentation to find out how to use formats beyond
        : > %s. BTW, there is no need to put a space at the end of
        : > a line.
        : >
        : >
        : > my $count = 5;
        : > printf "The desired value is (%s)\n", $count - 1;
        :
        : How about using eval()
        : printf "The desired value is ".eval($count - 1);

        I assume you mean print not printf. You're leaving
        the newline off the end in your solution. But why use
        eval()? What purpose does it serve? What advantage is
        there over not using it?


        print 'The desired value is ', $count - 1, "\n";


        Charles K. Clarkson
        --
        Head Bottle Washer,
        Clarkson Energy Homes, Inc.
        Mobile Home Specialists
        254 968-8328
      Your message has been successfully submitted and would be delivered to recipients shortly.