use strict; my $xml=< ... stuff... ...more stuff... ...shoe stuff... ENDOFXML while($xml=~m/\<(.+?)\>(.+?)\<\/\1\>/sig){ my $tag=lc(strip($1)); my $attribs="?"; my $value=strip($2); print "Tag: $tag\n"; print "\tattributes: $attribs\n"; print "\tvalue: $value\n"; } print "Done\n"; exit; ############### sub strip{ #usage: $str=strip($str); #info: strips off beginning and endings returns, newlines, tabs, and spaces my $str=shift; if(length($str)==0){return;} $str=~s/^[\r\n\s\t]+//s; $str=~s/[\r\n\s\t]+$//s; return $str; }