Hi all,
I've got a file with weird numbers that need to be reformatted. Here's a line from the file:
1 1 4 1 0.225120000000000D+06 0.341913000000000D+07 1 1 1 661 660 660
+659
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:
#!/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;
}
}
...
So far it works...kind of. Here's the output:
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
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?
Thanks!
^l9v