#!/usr/bin/perl -w my $file; my @info; my $line; my %data = (one => 1, two => 2, three => 3); foreach $file () { open (DATA, $file); @info = ; # @info contains the whole xml record foreach $line (@info) { chomp $line; $line =~ s|E-mail|Email|g; # make email tags match all other tags %data = map { /<(\w+)>\s*(.*?)<\/\w+>/; ($1, $2) } @info; } print "\n",$data{"Position"},"\t",$data{"GradYear"},"\t",$data{"Email"},"\n"; } close (DATA);