Is the data some sort of home-grown imitation of XML? If it was "real" XML, there wouldn't be a slash before the first close-angle-bracket. (I guess since it isn't real XML, it wouldn't help to recommend an XML parsing module.)
Do you mean something like this?
my $string = '...blah...<file fiop="foo" length="bar"/>baz</file>...bl
+ah...';
my ( $foo, $bar, $baz );
if ( $string =~ s{<file fiop="([^"]+)" length="([^"]+)"/>([^<]+)</file
+>}{} ) {
( $foo, $bar, $baz ) = ( $1, $2, $3 );
print "extracted $foo, $bar, $baz; left $string\n";
}