Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: using grep to search an array

by alicatserver (Initiate)
on May 23, 2011 at 21:11 UTC ( #906367=note: print w/replies, xml ) Need Help??


in reply to Re^3: using grep to search an array
in thread using grep to search an array

Chomp worked!! thanks

Replies are listed 'Best First'.
Re^5: using grep to search an array
by alicatserver (Initiate) on Jun 06, 2011 at 21:54 UTC
    I made an improvement to my script and I thought Id post it so that others can benefit from it.
    This rewritten version gives me two files... items that were "found" when searching the allper array and items that were "not found".
    (PS: the variables were renamed)

    foreach (@raw_data)
    {
    $item=$_;
    chomp($item);
    if (grep/$item/,@allper)
    {
    push(@found,grep/$item/,@allper);
    }
    else
    {
    push(@notfound,$item);
    }
    }

    open RESULT, ">_found_items.txt";
    print RESULT "@found\n\n";
    close(RESULT);

    open noRESULT, ">_doesnotexist.txt";
    print noRESULT "@notfound\n\n";
    close(noRESULT);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://906367]
help
Chatterbox?
[oiskuu]: tye, you were right: loginuid/sessionid are part of task struct if compiled with AUDITSYSCALL. I have some doubts if you should actually depend on that feature.
[Corion]: oiskuu: Depends on what you want to do with that information
[tye]: I'm not depending on that feature. But I could in this environment. I'm using getlogin(). shrug
[Corion]: For benign logging (which user started this DB instance), it's OK
[tye]: We use auditd for security monitoring. So we can rely on auditing being enabled. I'm not sure who would want to not be able to audit. Maybe some VM inside another system with audit?
[SuicideJunkie]: spies would want a system to not be able to audit.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2017-06-23 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (555 votes). Check out past polls.