open (REPORTFILE,">>$folder\\$reportfile")...
Some comments about this. First of all, you could benefit from being used to use lexical filehandles instead of package scoped ones, like:
open my $reportfile, ...
This will let you avoid nasty situations when your script grows and you find yourself opening REPORTFILE in more than one place. The usual "avoid globals if you can" stuff. You can then use it where you previously used REPORTFILE:
print $reportfile "TAG HIERARCHY REPORT\n";

Moreover, you're using the two-argument version of open, which should be avoided just to prevent the user shoot in her (or your) feet. The three-argument version needs only a bunch of chars more but is way more safe:

open my $resultfile, '>>', $filepath...
In this way, $filepath can contain stuff like "booh; rm -rf /" and still let you sleep well (I don't know an equivalently destructive command in win32, but you get the point).

The portable way to handle file paths is via File::Spec. Just in case you're interested into making your script more portable (which would probably require changes in the DB interface routines, too). Something along these lines:

my $filepath = File::Spec->catfile($folder, $reportfile); open my $reportfile, '>>', $filepath ...;

Last, but not least, you can provide a more sensible feedback to the user regarding the reasons why your script was unable to open the file, by means of the $! variable (see perlvar):

my $filepath = File::Spec->catfile($folder, $reportfile); open my $reportfile, '>>', $filepath or die "open('$filepath') for appending: $!";

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.

In reply to Re: Building a data Hierarchy by polettix
in thread Building a data Hierarchy by SlackBladder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.