El Jul 18, 2007, a las 11:19 PM, Joseph L. Casale escribió:
How can I detect this, I have been running some code for a few days
to develop some files and ran into the situation where I am getting
the following data for input:
14.95313 14.45312 0
14.95313 1.570813E-015 0
14.95313 -14.45313 0
-14.95313 -28.90625 0
-14.95313 -14.45313 0
-14.95313 1.570813E-015 0
-14.95313 14.45312 0
14.95313 -28.90625 0
0 -28.90625 0
-14.95313 28.90625 0
0 28.90625 0
14.95313 28.90625 0
And my code is skipping some lines as it checks for any erroneous
data:
next if grep (/[^0-9.-]/, @data);
But that thinks the scientific notation is bad. I searched the net
and didn't find anything. How can I match this specific pattern and
convert it?
I am not sure I understand the problem to solve.
You need to filter out lines that contain something that's *not* a
number? If that's the case, is @data a split on whitespace for each
line? If that's the case in turn, have a look at
perldoc -q determine
or delegate the job to Regexp::Common:
$ perl -MRegexp::Common -wle 'print 1 if "1.570813E-015" =~ /\A$RE
{num}{real}\z/'
1
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/