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).
In reply to Re: Regex Basics
by GrandFather
in thread Regex Basics
by mbeason
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |