Goes to show that if you plug away the answer will come....
while (<PIL>) {
# print ;
if (m/\ *object\ \{/) {
@lines = $_ ;
$objcount++ ;
} elsif (m/^\ *\}/) {
&Parse_Obj(@lines) ;
# print "Found Match!\n" ;
} else {
push @lines, $_ ;
}
}
sub Parse_Obj {
$id = @_[3] ; $origin = @_[1] ; $dims = @_[2] ;
$id =~ s/^.*?\"//g ; #remove up to first "
$id =~ s/\".*\n$//g ; #remove everything from last "
$origin =~ s/^.*?\{\ //g ; #remove up to first {
$origin =~ s/\ \}.*\n$//g ; #remove from last }
$dims =~ s/^.*?\{\ //g ; #remove up to first {
$dims =~ s/\ \}.*\n$//g ; #remove from last }
( $originw, $originh ) = split / /, $origin ;
( $dimsw, $dimsh ) = split / /, $dims ;
# print "$objcount : $id $originw $originh $dimsw $dimsh \n" ;
if (exists($object{$objcount})) {
break
} else {
$object{"$objcount$;id"} = $id ;
$object{"$objcount$;originw"} = $originw ;
$object{"$objcount$;originh"} = $originh ;
$object{"$objcount$;dimsw"} = $dimsw ;
$object{"$objcount$;dimsh"} = $dimsh ;
}
}
# print "join(" ", %object) \n" ;
for ($count < $objcount) {
print "$object{$count,id} $object{$count,originw} $object{$count,origi
+nh} \n" ;
}
Thanks for everybody's help.
~Das Ham Man |