T
Tim
Hello all, I am trying to get a simple Perl script working to
transform some data, but have an incredibly onerous solution that
looks more like visual basic than perl using lots of conditional
statements, while loops and the shift function. Something inside
doesn't feel right about that, plus I think I am missing out on
expanding my limited Perl knowledge.
My data is in the general form:
_________________________
TEXT {
title: test
font: script
}
POLYGON {
name: foo
type: good
POINTS 3 {
4,3
2,16
633,2
}
}
JUNK {
title: nothing
}
POLYGON {
name: foo2
type: bad
POINTS 2 {
7,9
3,2
}
}
Now I want to extract the points where the polygon type is 'good' so
my
output would be:
4,3
2,16
633,2
I can get Text::Balanced to work on a single line, but don't know how
to elegantly parse down to the fields I need. Any thoughts would be
greatly appreciated. Not committed to Text::Balanced, but it seems
like it should work.
best,
Tim
transform some data, but have an incredibly onerous solution that
looks more like visual basic than perl using lots of conditional
statements, while loops and the shift function. Something inside
doesn't feel right about that, plus I think I am missing out on
expanding my limited Perl knowledge.
My data is in the general form:
_________________________
TEXT {
title: test
font: script
}
POLYGON {
name: foo
type: good
POINTS 3 {
4,3
2,16
633,2
}
}
JUNK {
title: nothing
}
POLYGON {
name: foo2
type: bad
POINTS 2 {
7,9
3,2
}
}
Now I want to extract the points where the polygon type is 'good' so
my
output would be:
4,3
2,16
633,2
I can get Text::Balanced to work on a single line, but don't know how
to elegantly parse down to the fields I need. Any thoughts would be
greatly appreciated. Not committed to Text::Balanced, but it seems
like it should work.
best,
Tim