Hey,
I was trying to delete a particular pattern say something like <HTML> from a text file.
How would I do that in perl?

The following reads each line from an input file, removes the specified pattern from each line, if found, and prints each line to standard output, which could easily be redirected to a file.

#!/usr/bin/perl
use strict;
use warnings;

*ARGV = *DATA if scalar(@ARGV) == 0;

while (<>) {
    s/<HTML>//g;
    print;}

__DATA__
Hello there.
The words here at the end of the script
supply default testing data in case there
is no input file named on the command line.
If you want to delete all occcurences of <HTML> and <HTML> and <HTML>
then this should do it, but what about the </HTML> tag?
The </HTML> won't get deleted but the <HTML> tag will.
Is that what you want?
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.