http://www.perlmonks.org?node_id=1012901

scotb has asked for the wisdom of the Perl Monks concerning the following question:

I need to provide a search option for the user where they search for a name and it returns the address of the user they entered.

$loopIndex = 0; $input = <STDIN>; chomp($input); foreach (@a) { if($_ =~ m/<name> [A-Z]/) { print "Contact: @a[$loopIndex -1]" ; } $loopIndex++; }

I am not sure what needs to be added to this or if it is even close! appreaciate your help

EDIT: The data is being pulled from an xml file. I am searching for the name but need to read back other elements such as address from the xml.