Hi,
I would like to gather two types of information and put into an array. For instance, I have a file with 4 lines of info for each entry - I want to get the name and occupation only for each entry. How can I get just the name and occupation in an efficient manner?
File example:
Name : Bob Smith
address : somewhere, USA
gender : male
Occupation : Engineer
Output should be:
Bob Smith, Engineer
So far I can just gett the names - not both name and occupation.
while ($line1 = <LIST>)
{
chomp;
if ($line1 =~ /^Name\s+\:\s(\S+)\s+/) {
$name = $1;
push (@info, "$name\n");
}
}
Thanks for any help!