looking for a piece of code to get the values from a structured text file like this:
###############################################################################
###############################################################################
#
# PERSONAL DATA DEFINITIONS
#
###############################################################################
###############################################################################
define person{
first_name John
last_name Peterson
nickname Peter
address 1024 Maple street
birthday November 11th, 1970
}
define office{
use home office
office_name main
office_description home post office
}
define person{
first name Jamie
last name Bluff
nickname Bluff
address 134 Downing street
birthday October 15th, 1974
}
define person{
first name Melanie
last name Houston
nickname Mell
address 111 Boston street
birthday January 5th, 1969
}
define office{
use foreign office
office_name main
office_description foreign post office
}
define person{
first name Blake
last name Dawson
nickname Blakey
address 512 Kendrick street
birthday February 6th, 1970
}
Need to get only values from "define person" parts of the file. The rest needs to be
ignored.
yazu, thank you very much for this, it works from the command line. But I'd like to use it from within
perl script. Is there a way to use the command above in the perl script?
Thanks a lot. It works perfectly. Another question: is it possible each time when the structure
"define person {...}" is found in the file, to put it in an array which would then contain a single set of
data about one person (and not to print it to STDOUT)?