in reply to Why is grep not searching for contents?
You need to actually open the file for parsing.
#!/usr/bin/perl -w use strict; use warnings; my $folder= "oem"; my $file = "./oem.h"; open my $fh, $file or die $!; my @array = <$fh>; close $fh; my @content = grep {/\Q$folder\E/} @array; print "@content";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why is grep not searching for contents?
by Anonymous Monk on Apr 30, 2011 at 03:27 UTC | |
by John M. Dlugosz (Monsignor) on Apr 30, 2011 at 10:15 UTC | |
by Anonymous Monk on Apr 30, 2011 at 04:18 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |