Hi All,
I have a text file like this:
Name ,123-43-4352, JX, 1234
Sports,123-43-4352, SKI, BaseBall, swimming
Hobbies, 123-43-4352, H1,H2, H3
Hobbies, 123-43-4352, HH, HHH, HHHH2
Hobbies,123-43-4352, H1,H43
Name ,223-63-9352, JX, 1234
Sports,223-63-9352, SKI, BaseBall, swimming
Hobbies, 223-63-9352, H1,H2, H3
Hobbies, 223-63-9352, HH, HHH, HHHH2
Here is my issue, I am trying to access each record in this file by SSN
ie: (223-63-9352)
I want to be able to say:
for SSN = 223-63-9352, for Hobbies4 4th entry is HGFR.
while ($line = <INPUT>){
@line = &parse_line(',',0,$line);
if ($line[0] =~ /^NAME/gi){
$ssn = $line[1] ;
push(@ssns, $ssn);
}
if ($line[0] =~ /^Sports/gi ){
push(@sports, $line)
}
if ($line[0] =~ /^Hobbies/gi){
push(@hobbies, $line)
}
for ($i = 0; $i<= $#ssns; $i ++)
{
print "For $ssns[$i]\n";
for ($i = 0; $i <= $#Hobbies ; $i++){
if ($Hobbies[$i] =~ $ssns[$i])
{ print "Hobbies are: $Hobbies[$i]\n";}
}
I wanted to print out for each SSN corresponding SSN numbers but it's just
not working!!! If this is feasible in Perl I'd appreciate if someone could help.
Thanks
I.S
__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at
http://webmail.netscape.com/