Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Subtracting Stringified Negative Numbers

by naikonta (Curate)
on Jun 22, 2007 at 04:23 UTC ( #622707=note: print w/replies, xml ) Need Help??

in reply to Subtracting Stringified Negative Numbers

That's really strange. Are you sure that $n1 and $n2 are assigned with literal value as you do, and not from any external resources or inputs?

Update: Following your update, now we know that $n1 is splitted out from $some_string. But, where the heck this $some_string came from? It's the ultimate source of the data you need to tell so we know how is the data originally or initially the first time it arrives to the perl interpreter or your script. Don't emulate by literally assinging it to a variable if that's not actually the case since we'll just get nowhere.

$ cat use strict; use warnings; my $n1 = '-933'; # the same result my $n2 = '-1039'; # without quotes my $diff = $n1 - $n2; print "diff: $diff\n"; $ perl diff: 106 $ perl -V Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.9-22.18.bz155725.elsmp, archname=i386-lin +ux-thread-multi uname='linux 2.6.9-22.18.bz155725.elsm +p #1 smp thu nov 17 15:34:08 est 2005 i686 i686 i386 gnulinux '

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://622707]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-07-19 10:22 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (406 votes). Check out past polls.