while ( $indata =~ s{(.*?)}{}s )
{
( $fiop, $fileLength, $fileData ) = ( $1, $2, $3 );
# do something with $fileData, possibly after checking that
# $fileLength == length( $fileData ), if that matters to you
}
if ( $indata =~ m{} )
{
# there's something wrong with the posted data, so it's still
# not suitable for XML parsing...
}