licking9Volts has asked for the wisdom of the Perl Monks concerning the following question:
I need to take the large numbers, add 30 to one of them, and then print them back out in a "normal" format. Here's what I have so far:1 1 4 1 0.225120000000000D+06 0.341913000000000D+07 1 1 1 661 660 660 +659
So far it works...kind of. Here's the output:#!/usr/sbin/perl -w use strict; ... if (/^\s+1/) { @info = split(' ', $_, 9999); $my_x = $info[4] + 0; $my_y = $info[5] + 30; for($i = '1'; $i <= $info[2]; $i++) { print ("$my_x $my_y $info[($i + 8)]\n"); $my_y = $my_y + 30; } } ...
It seems to always give me a warning the first time it tries to print the large numbers. After that, it doesn't seem to mind. Is there a way to convert the numbers in weird notation to their non-decimal counterparts without an error?Argument "0.225120000000000D+06" isn't numeric in addition (+) at H:\d +em2xyz.pl line 33, <FILE> line 2. Argument "0.341913000000000D+07" isn't numeric in addition (+) at H:\d +em2xyz.pl line 34, <FILE> line 2. 225120 3419160 661 225120 3419190 660 225120 3419220 660 225120 3419250 659 Argument "0.225150000000000D+06" isn't numeric in addition (+) at H:\d +em2xyz.pl line 33, <FILE> line 3. Argument "0.341913000000000D+07" isn't numeric in addition (+) at H:\d +em2xyz.pl line 34, <FILE> line 3. 225150 3419160 661 225150 3419190 659 225150 3419220 660
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(z) Re: Weird number formatting
by zigdon (Deacon) on Mar 05, 2003 at 17:52 UTC | |
by tye (Sage) on Mar 05, 2003 at 19:14 UTC | |
by licking9Volts (Pilgrim) on Mar 05, 2003 at 18:00 UTC | |
by VSarkiss (Monsignor) on Mar 05, 2003 at 18:16 UTC | |
by rje (Deacon) on Mar 05, 2003 at 18:11 UTC | |
by krusty (Hermit) on Mar 05, 2003 at 18:57 UTC | |
|
Re: Weird number formatting
by fruiture (Curate) on Mar 05, 2003 at 17:53 UTC | |
|
Re: Weird number formatting
by hv (Prior) on Mar 05, 2003 at 18:46 UTC | |
|
Re: Weird number formatting
by hardburn (Abbot) on Mar 05, 2003 at 17:13 UTC | |
by licking9Volts (Pilgrim) on Mar 05, 2003 at 17:52 UTC | |
|
Re: Weird number formatting
by licking9Volts (Pilgrim) on Mar 06, 2003 at 22:04 UTC |