I only want to use data like '1.57172 ,17:30:08 ' for my computation, e.g.. i want to disregard data that looks like ' 1.571 ,17: ' I would also like to use ' 1.57163 ,17:29:57 Simple Dealin ', if my code was capable of ignoring the data after the time.//input.txt 1.57163 ,17:29:57 Simple Dealin 1.57163 ,17:29:57 1.57163 ,17:29:57 1.57163 ,17:29:57 1.57163 ,17:29:57 1.57163 ,17:29:57 1.57163 ,17:29:57 1.571 ,17: 1.57172 ,17:30:08 1.57176 ,17:30:10
The code i have come up with isnt good enough, which is below..
What i need is for my code to only accept input of 1 digit before the decimal place and 5 after , a space, a comma.. then an 8 character time using : as a seperator that will ignore any data on the same line after the seconds.while (<DATAFILE>) { unless (m{^(.*?)\s*,([\d:]+)}) { next; } chomp $_; ($quote,$time) = split(",", $_); // do my computations chop($quote);chop($quote);
can anyone help me flush out this bug in my script please?
In reply to handling erronous input by Conal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |