I see many flaws in this logic. Can you give use say 5 lines of UFRAME input data? And your expected output for those 5 line of input?

I am not sure what you intend with the format spec %.3f?
That rounds the floating point input to 3 decimal places like this:

use strict; use warnings; foreach (3.5, 2.6888, 8.25 ,8, 1249.7999999999999999) { printf("%.3f\n", $_); } __END__ 3.500 2.689 note <= rounding up from 2.6888 8.250 8.000 1249.800 <= note rounded up from 7999999999999
Update: I am not sure what you desire.
This is some simple code that uses "match regex global" to get the numbers from lines that start with UFRAME.
use strict; use warnings; while (my $line = <DATA>) { if ($line =~ m/^UFRAME/) { my @numbers = $line =~ /([\d.]+)/g; print "UFRAME numbers: @numbers\n"; @numbers = map{sprintf "%.3f",$_}@numbers; print "UFRAME numbers with 3 decimal points: @numbers\n\n"; } } =prints: UFRAME numbers: 3.0 5.6 7.9000999 43.08999 UFRAME numbers with 3 decimal points: 3.000 5.600 7.900 43.090 UFRAME numbers: 2.57777 32.000 54 1 UFRAME numbers with 3 decimal points: 2.578 32.000 54.000 1.000 =cut __DATA__ nonsense UFRAME 3.0, 5.6, 7.9000999, 43.08999 BS UFRAME 2.57777, 32.000,54,1
Update:

Just as a simple formulation of your code, consider this and how to get what you want out of it.

#!/usr/bin/perl use strict; use warnings; #data format #UFRAME,index,number,x,y,z while (my $line =<DATA>) { next unless $line =~ /UFRAME/; chomp $line; my (undef,$index,$number,@coordinates) = split /,/,$line; print "Index=$index, Number=$number, Coordinates =@coordinates\n"; warn_coordinate_zero(@coordinates); } sub warn_coordinate_zero { my (@corrdinates)= @_; print " X value is not zero\n" if (shift @corrdinates); print " Y value is not zero\n" if (shift @corrdinates); print " Z value is not zero\n" if (shift @corrdinates); } =Prints Index=32, Number=14, Coordinates =0 0 0 Index=32, Number=99, Coordinates =0 0 45 Z value is not zero Index=32, Number=959, Coordinates =65 0 0 X value is not zero Index=32, Number=959, Coordinates =99 0 23 X value is not zero Z value is not zero =cut __DATA__ UFRAME,32,14,0,0,0 BOGUS UFRAME,32,99,0,0,45 UFRAME,32,959,65,0,0 UFRAME,32,959,99,0,23

In reply to Re: Best way to "Skip" a set of operations by Marshall
in thread Best way to "Skip" a set of operations by thnksnw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.