home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
c
/
cops_104.zip
/
cops_104
/
perl
/
fgrep.pl
< prev
next >
Wrap
Perl Script
|
1992-03-10
|
463b
|
27 lines
#
# Just a quick perl fgrep...
#
package fgrep;
sub main'fgrep {
local($file, @exprs) = @_;
local(@list);
if (open file) {
$code = "while (<file>) {\n\tchop;\n";
for (@exprs) {
$code .= "\tpush(\@list, \$_), next if m\201${_}\201;\n";
}
$code .= "}\n";
warn "fgrep code is $code" if $debug;
eval $code;
warn "fgrep @exprs $file: $@\n" if $@;
} elsif ($debug) {
warn "main'fgrep: can't open $file: $!\n";
}
@list;
}
1;