Hi guys,
I must have been dreaming when I tested this and ran it the first time as I
thought it worked! Now it's not :P
Anyone know what's wrong here, can I not leverage the expand sub to convert the
scientific notation in the printf statement like I am?
sub expand {
my $n = shift;
return $n unless $n =~ /^(.*)e([-+]?)(.*)$/;
my ($num, $sign, $exp) = ($1, $2, $3);
my $sig = $sign eq '-' ? "." . ($exp - 1 + length $num) : '';
return sprintf "%${sig}f", $n;
}
while (<FILEIN>) {
my @data = split;
next unless @data == 3;
next if grep { not /^$RE{num}{real}$/ } @data;
printf FILEOUT "X%s Y%s\n", expand($data[0]), expand($data[1]);
printf FILEOUT "Z[%s+DPad]\n", expand($data[2]);
print FILEOUT "M98PDRILL.SUBL1\n";
print FILEOUT "G90\n";
print FILEOUT "G00 Z[CPlane]\n"
}
Thanks!
jlc