#!/usr/bin/perl use strict; use warnings; #data format #UFRAME,index,number,x,y,z while (my $line =) { 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