I want to print out all the keys through my loop that dont exist in my hash NgrpsHash, but its only printing one of them, cbtest.
use strict; use warnings; my $notexists = 0; my $hashdiff = ( (scalar keys %EgrpsHash) - (scalar keys %NgrpsHash) +); print "\nI am now checking primary and secondary groups defined in AD +and locally on $host...\n"; LABEL: for my $ekey (keys %EgrpsHash) { last if $notexists >= $hashdiff; if ( ! exists $NgrpsHash{$ekey} ) { print uc("\n$nuser is **not** in the same 'ad' and or 'local' +groups as $euser is!\n\n"); print uc("*** $nuser needs to be in ''$ekey'' group(s) for int +erface support rights! ***\n\n"); print "Please correct this then rerun with the -r flag!\n\n"; print "$nuser\'s AD+local groups\n", join("\n", sort keys %Ngr +psHash),"\n"; print '=' x 11,"\n"; print "$euser\'s AD+local groups\n", join("\n", sort keys %Egr +psHash),"\n\n"; print uc("please change this within centrify gui! right-click +on new user, properties, profile tab, primary group, then rerun \n\n" +); ++$notexists; goto LABEL; } }
__DATA__ is tsilvia's AD+local groups cbpro_group cbproop cbqa cbqaop cbtestop =========== thendri1's AD+local groups cbpro cbpro_group cbproop cbqa cbqaop cbtest cbtestop
thx!

In reply to ! exists in my hash. want to see all that dont exist. by dbs

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.