The following (untested) code should be closer to what you want:

use strict; use warnings; my @node_list = glob("/appl/perform/workspace/htdocs/node_reports/*/*" +); my $node = ""; my %needs_desc; foreach my $file (@node_list) { next if $file =~ /^(?:\.\.? | lost\+found)$/x; my ($node, $filename) = (split /\//, $file)[6,7]; my $pattern = "business_use\.$node"; $needs_desc{$node} = 0; ++$needs_desc{$node} if $filename =~ /^$pattern/; } for my $node (sort keys %needs_desc) { print "$node\n" if !$needs_desc{$node}; }

You really need to visit the Tutorials section and do a little reading about hashes in particular.

Note that I've fixed a number of errors and refactored some of the code somewhat, in large part to cut away cruft and make the solution to the actual problem clearer (I hope).


DWIM is Perl's answer to Gödel

In reply to Re: Regex Basics by GrandFather
in thread Regex Basics by mbeason

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.