I have taken what cdarke has advised on board and tried to break it down into 6 small chunks:

# 1 - Prompt the user to enter the filename .

#2 - Verify the file extension to make sure it's htm or html.

#3 - Open the file and read each line of the file.

#4 - Change all tags to uppercase.

#5 - Tag attributes need to remain in lowercase.

#6 - Original file needs renaming with the .old extension and the processed file needs the original filename.

This is what I've got so far (not a great deal of progress).

#1

Print ("Please enter the name of your html file\n"); $file = (<STDIN>);

#2

(I have the following regular expression) ($file =~ s/html|htm$/i).

Would I be best putting this in an IF statement ?.

#3 & #4

open (IN, $file); open (OUT, >$file); while ($line = [IN]) { $line =~ s/[html]/[HTML]/;<code> # Would I have to do the above line for all possible tags or is there +an easier way ?. <code>(print OUT $line); }
Struggling on part #5 !.

#6

Got the feeling I'm going to need to use something like the following.

rename $file, "$file.old"; open (IN, "<$file.old"); Open (OUT, ">$file");

In reply to Re^2: Converting HTML tags to upper case by Bern
in thread Converting HTML tags to upper case by Bern

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.