>>>>> "BFY" == Brian F Yulga <[email protected]> writes:
BFY> My apologies if I'm beating a dead horse here, but I'm new to Perl and
BFY> thought of a slightly different approach:
BFY> my $searchrx = qr/whatever/; # or q/whatever/ if you don't need regexp
BFY> @ARGV or die qq/you didn't specify a filename\n/;
BFY> open FH, q/</, shift @ARGV or die qq/file open error: $!/;
BFY> $_ = join q//, <FH>;
that is very slow and clunky. perl could slurp the file for you if you
set $/ to undef. or better yet, use File::Slurp to do it
BFY> close FH;
BFY> if ( ! m/$searchrx/s ) {
why are you using m//? the m isn't needed if you use // for delimiters
the OP wants to know if a file has something or not, not to print each
line.
uri
--
Uri Guttman ------ [email protected] -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/