Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Silly Perl Question

  • 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, Registered Users 2, Paid Member Posts: 5,051 ✭✭✭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