# 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
Struggling on part #5 !.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); }
#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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |