On Aug 8, 2:29 am, [EMAIL PROTECTED] (kapil.V) wrote: > I tried this to see if the file is an html: > perl -ne '!<html>.+?</html>!s and print "html\n"' html.htm > This does not work. What is the problem?
-n repeatedly loops through all lines of the file, each iteration assigning $_ to be the current line. You are repeatedly testing to see if each individual line matches that pattern, which of course none do. To change the input record separator so that the entire file is read at once, use the -0 option: perl -0ne '!<html>.+?</html>!s and print "html\n"' html.htm (that's a zero, not a capital o) Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/