Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Silly Perl Question

Options
  • 08-04-1999 12:59am
    #1
    Closed Accounts Posts: 202 ✭✭


    OK I know this is prolly REALLY easy and all but I'm only learning Perl at the mo, so go easy on me k?

    I want to write a script that scans through a HTML page and converts all lowercase HMTL to uppercase. AFAIK I've tried everything and it still won't work.

    No one-liners please, like I said I'm still just a beginner.

    Thanks
    Karla


Comments

  • Registered Users Posts: 5,049 ✭✭✭Cloud


    Not entirely sure about this but to convert a string from lower to upper case use:

    $String_Name =~ tr/a-z/A-Z/;

    Now if there's someway to combine that with the s/ replace function...

    Another way is to do each HTML tag:

    $String_Name =~ s/\<b\>/\<B\>/ig;

    i at the end ignores case, g is for global replace throughout the string.

    If this helps let me know. http://www.sci.kun.nl/thalia/perlhelp/perl_20.html

    John.
    --




  • Closed Accounts Posts: 202 ✭✭Karla


    Cheers Cloud

    I can't seem to get either of those to work but I did find a HMTL formatter.
    I haven't had time to take the code apart just yet but here's the link if you're intersted.

    http://watson-net.com/free/perl/s_fhtml.asp

    Thanks a lot smile.gif
    Karla



Advertisement