"here I tryed to make a sum. with "my $n= "$val+8";", so that I can obtain a vlue like -31.9999400000 (instead of '-39.9999400000'+8). But unfortunately that does not work. So how can I solve this problem? (that was the reason why I thought it is a string value)."
I know you've only been using Perl for a short amount of time, but I don't think you've really got an understanding of the basics. Try reading "perlintro -- a brief introduction and overview of Perl": you need a solid foundation on which to build further knowledge.
With regard to your "$val+8" question, this code should explain why it's not working:
#!/usr/bin/env perl -l use strict; use warnings; my @items = (-39.9999400000); my $val = $items[-1]; print $val; my $n = "$val+8"; print $n; my $x = $val+8; print $x;
Output:
-39.99994 -39.99994+8 -31.99994
-- Ken
In reply to Re^4: string to number via data dumper
by kcott
in thread string to number via data dumper
by semipro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |