Generating random XML documents
Yes, that's pretty good. It's essential to include use strict at the top of every Perl program you write, and use warnings is preferable to -w on the command line. You should also avoid capital letters in identifiers for lexical variables, as they are reserved for use in global identifiers such as package names

I would write something more Perlish like this

#!/usr/bin/perl

use strict;
use warnings;

use XML::Mini::Document;

use constant OUTFILE =&gt; 'D:/Test.xml';

sub rand_letter { chr(ord('A') + rand(26)) }

my $new_doc = XML::Mini::Document-&gt;new;
my $root    = $new_doc-&gt;getRoot;
my $header  = $root-&gt;header('xml');
$header-&gt;attribute(version  =&gt; '1.0');
$header-&gt;attribute(encoding =&gt; 'UTF-8');

my $records= $root-&gt;createChild('records');

my $sequence = 1000;

for ( 0..9 ) {

    my $record = $records-&gt;createChild('record');

    my ($random_name, $random_desc);
    $random_name .= rand_letter for 1 .. 6;
    $random_desc .= rand_letter for 1 .. 15;

    $record-&gt;createChild(ID   =&gt; ++$sequence);
    $record-&gt;createChild(Name =&gt; $random_name);
    $record-&gt;createChild(Desc =&gt; $random_desc);
}

open my $fh, '&gt;', OUTFILE or die $!;
select $fh;
print $new_doc-&gt;toString;