calculation in string

Discussion in 'Perl' started by Daniel, Aug 27, 2003.

  1. Daniel

    Daniel Guest

    I've a dynamic variable
    $var_tmp = "/18";
    where the "/18" can also be "/18+100"
    I also got a variable
    $var_prize = 2000
    now the thing is I have to get this
    $var_total = 2000/18+100;

    anybody knows how this works ?!?
     
    Daniel, Aug 27, 2003
    #1
    1. Advertising

  2. Daniel

    PapaBear Guest

    eval? rtfm?

    --
    __________________________________
    Never mind the bear, beware of Papa!


    "Daniel" <> schreef in bericht
    news:3f4c7dbf$0$49114$4all.nl...
    > I've a dynamic variable
    > $var_tmp = "/18";
    > where the "/18" can also be "/18+100"
    > I also got a variable
    > $var_prize = 2000
    > now the thing is I have to get this
    > $var_total = 2000/18+100;
    >
    > anybody knows how this works ?!?
    >
    >
     
    PapaBear, Aug 27, 2003
    #2
    1. Advertising

  3. Daniel

    Purl Gurl Guest

    Daniel wrote:

    > I've a dynamic variable
    > $var_tmp = "/18";
    > where the "/18" can also be "/18+100"
    > I also got a variable
    > $var_prize = 2000
    > now the thing is I have to get this
    > $var_total = 2000/18+100;


    > anybody knows how this works ?!?



    Yours does not work.

    2000 / 18 + 100 = 211.111111111111111111111111111111

    2000 / (18 + 100) = 16.9491525423728813559322033898305


    Give this some thought.


    Purl Gurl
     
    Purl Gurl, Aug 27, 2003
    #3
  4. "Daniel" <> wrote in news:3f4c7dbf$0$49114
    $4all.nl:

    > I've a dynamic variable
    > $var_tmp = "/18";
    > where the "/18" can also be "/18+100"
    > I also got a variable
    > $var_prize = 2000
    > now the thing is I have to get this
    > $var_total = 2000/18+100;
    >
    > anybody knows how this works ?!?
    >
    >


    $var_total = $var_prize . $var_tmp; ??

    --
    Eric
    $_ = reverse sort $ /. r , qw p ekca lre uJ reh
    ts p , map $ _. $ " , qw e p h tona e and print
     
    Eric J. Roode, Aug 28, 2003
    #4
  5. Daniel

    Trent Curry Guest

    "Daniel" <> wrote in message
    news:3f4c7dbf$0$49114$4all.nl...
    > I've a dynamic variable
    > $var_tmp = "/18";
    > where the "/18" can also be "/18+100"
    > I also got a variable
    > $var_prize = 2000
    > now the thing is I have to get this
    > $var_total = 2000/18+100;
    >
    > anybody knows how this works ?!?


    $var_total = eval($var_tmp);
    will do what you want.

    Also, alt.comp.lang.perl & comp.lang.pelr are very rare if not virtually
    extinct news groups. I don't think too many people get them. Though there
    seems to be SOME activity in those two said groups...
     
    Trent Curry, Sep 10, 2003
    #5
  6. Daniel

    Trent Curry Guest

    "Daniel" <> wrote in message
    news:3f4c7dbf$0$49114$4all.nl...
    > I've a dynamic variable
    > $var_tmp = "/18";
    > where the "/18" can also be "/18+100"
    > I also got a variable
    > $var_prize = 2000
    > now the thing is I have to get this
    > $var_total = 2000/18+100;
    >
    > anybody knows how this works ?!?


    $var_total = eval($var_tmp);
    will do what you want.

    Also, alt.comp.lang.perl & comp.lang.perl are very rare if not virtually
    extinct news groups. I don't think too many people get them. Though there
    seems to be SOME activity in those two said groups...

    Or is alt.comp.lang.perl just a lesser known group?
     
    Trent Curry, Sep 10, 2003
    #6
  7. Daniel

    Anno Siegel Guest

    Trent Curry <> wrote in comp.lang.perl.misc:
    > "Daniel" <> wrote in message
    > news:3f4c7dbf$0$49114$4all.nl...
    > > I've a dynamic variable
    > > $var_tmp = "/18";
    > > where the "/18" can also be "/18+100"
    > > I also got a variable
    > > $var_prize = 2000
    > > now the thing is I have to get this
    > > $var_total = 2000/18+100;
    > >
    > > anybody knows how this works ?!?

    >
    > $var_total = eval($var_tmp);
    > will do what you want.
    >
    > Also, alt.comp.lang.perl & comp.lang.perl are very rare if not virtually
    > extinct news groups. I don't think too many people get them. Though there
    > seems to be SOME activity in those two said groups...
    >
    > Or is alt.comp.lang.perl just a lesser known group?


    alt.comp.lang.perl is a legit alternative to the mainstream Perl groups.
    comp.lang.perl has been decommissioned many years ago -- it *shouldn't*
    exist anywhere, but a sizeable minority of news server still carry it.

    Anno
     
    Anno Siegel, Sep 10, 2003
    #7
  8. Daniel

    Trent Curry Guest

    --
    Stan
    "Anno Siegel" <-berlin.de> wrote in message
    news:bjmr18$2ce$-Berlin.DE...
    > Trent Curry <> wrote in comp.lang.perl.misc:
    > > "Daniel" <> wrote in message
    > > news:3f4c7dbf$0$49114$4all.nl...
    > > > I've a dynamic variable
    > > > $var_tmp = "/18";
    > > > where the "/18" can also be "/18+100"
    > > > I also got a variable
    > > > $var_prize = 2000
    > > > now the thing is I have to get this
    > > > $var_total = 2000/18+100;
    > > >
    > > > anybody knows how this works ?!?

    > >
    > > $var_total = eval($var_tmp);
    > > will do what you want.
    > >
    > > Also, alt.comp.lang.perl & comp.lang.perl are very rare if not virtually
    > > extinct news groups. I don't think too many people get them. Though

    there
    > > seems to be SOME activity in those two said groups...
    > >
    > > Or is alt.comp.lang.perl just a lesser known group?

    >
    > alt.comp.lang.perl is a legit alternative to the mainstream Perl groups.
    > comp.lang.perl has been decommissioned many years ago -- it *shouldn't*
    > exist anywhere, but a sizeable minority of news server still carry it.


    Unfortunately, my server carries both :(
    Thank you for the info though.
     
    Trent Curry, Sep 10, 2003
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sunil

    power calculation in fpga

    sunil, Feb 10, 2004, in forum: VHDL
    Replies:
    2
    Views:
    1,298
    Brendan Cullen
    Feb 11, 2004
  2. Runar Gjelsvik

    CRC polynomal calculation

    Runar Gjelsvik, Apr 28, 2004, in forum: VHDL
    Replies:
    2
    Views:
    2,302
    Allan Herriman
    Apr 29, 2004
  3. =?Utf-8?B?SXNzYWMgR29tZXo=?=

    Date Calculation

    =?Utf-8?B?SXNzYWMgR29tZXo=?=, Jun 9, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,439
    mikeb
    Jun 9, 2004
  4. vadim

    bandwidth calculation

    vadim, Dec 31, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    514
    Ken Dopierala Jr.
    Dec 31, 2004
  5. Ken Bloom
    Replies:
    2
    Views:
    154
    Ken Bloom
    Feb 22, 2007
Loading...

Share This Page