By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,852 Members | 2,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,852 IT Pros & Developers. It's quick & easy.

Covert html to HTML

P: 2
Hi there
can any one help me I would like to make a perl script to make me convert a file with html tags form lowercase to uppercase from a file .html
Jul 27 '08 #1
Share this Question
Share on Google+
4 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
Ok, why not post the code you have tried here and we will help you get it working. But, you have to make an effort as this is not a coding service. Also, please surround your code with the proper code tags.

Regards,

Jeff
Jul 27 '08 #2

KevinADC
Expert 2.5K+
P: 4,059
sounds like school work. This is one of the basic assignments of many a perl course.
Jul 27 '08 #3

P: 2
i tried this but id don's not work

Expand|Select|Wrap|Line Numbers
  1. while ($a= <STDIN>)
  2. {
  3. if ($a =~ tr/a-z/A-Z)
  4. {
  5. print "$a\n";
  6. }
  7. if ($a =~ tr/A-Z/a-z/)
  8. {
  9.    print"the uppercase is $a\n";
  10. }
  11.    elsif ($a =~ tr/[A-Z]/[a-z]/)
  12. {
  13.  $b=$a;
  14.  $b=~tr/a-z/A-Z/c;
  15.  print "$b\n";
  16. }
  17. }
Aug 4 '08 #4

nithinpes
Expert 100+
P: 410
i tried this but id don's not work

Expand|Select|Wrap|Line Numbers
  1. while ($a= <STDIN>)
  2. {
  3. if ($a =~ tr/a-z/A-Z)
  4. {
  5. print "$a\n";
  6. }
  7. if ($a =~ tr/A-Z/a-z/)
  8. {
  9.    print"the uppercase is $a\n";
  10. }
  11.    elsif ($a =~ tr/[A-Z]/[a-z]/)
  12. {
  13.  $b=$a;
  14.  $b=~tr/a-z/A-Z/c;
  15.  print "$b\n";
  16. }
  17. }

You have tried to translate lower case characters to uppercase and then back to lowercase and further UC to LC multiple times. I am confused about your objective!!
The very first expresssion that you have used in if loop (note the missing forward slash'/') will translate all lower case characters to upper case.
Expand|Select|Wrap|Line Numbers
  1. $a =~ tr/a-z/A-Z/ ;
  2.  
What you are confused with is probably the wrong print statement in second if loop. It should be - "the lowercase is $a\n".
Aug 5 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.