on Tue, 21 May 2002 15:17:38 GMT, [EMAIL PROTECTED] (Kenny
Madsen) wrote: 

> I define two arrays - one is an active changing file  ( @unix = ps
> -ef ) and need to compare it to a static text file @static = `cat
> myfile`.  
>  
> Would someone help me on the syntax of greping for @static matches
> in the @unix array.

#! /usr/bin/perl -w
use strict;

# Create the 'static' lines by running a 'ps -ef' call
# and store them as haskeys (I don't have your 'myfile':-)

my @static = `ps -ef`;
my %static = map { $_ => 1} @static;

# Changing lines
my @unix = `ps -ef`;

print "The following lines are the same:\n";
for (@unix)  {
        print if $static{$_};
}

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to