iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • I love the code... dot com
    125,003

    iLoveTheCode.com
    Perl > Perl Tutorials How To Easy > Substitute in Perl

    Substitute in Perl



    $ft="Lindon";
    $ft =~ s/i/o/;

    $ft now equals London.

    -The variable you named $ft contains the typoed city London.
    -The s after the ~ tilde symbol means substitute.
    -Between the first two slashes, you type what is to be replaced.
    -Between the second two slashes, you type what to replace with.

    $ft="TOKYO";
    $ft =~ s/o//ig;

    $ft is now equal to Tky.

    -This time we replaced o's with nothing.
    -The i means case-INsensitive.
    -The g means change ALL the o's in $ft.

    Copy and Paste Perl Code:

    #!/usr/bin/perl

    print "Content-type:text/html\n\n";

    $ft="Lindon";
    $ft =~ s/i/o/;

    print "$ft ";

    $ft="TOKYO";
    $ft =~ s/o//ig;

    print "$ft";


    exit;



    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Getting Server Time in Perl
    Next Article: What's in an Array, Index Numbers





    CSSCSS

    Eric Meyer

    New $29.69

    Head First HTML with CSS...Head First HTML with CSS & XHTML

    Eric Freeman, Elis...

    New $23.99

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    HTML & XHTMLHTML & XHTML

    Chuck Musciano, Bi...

    New $29.99

    Information Architecture...Information Architecture for the Wor...

    Louis Rosenfeld, P...

    New $26.39

    New Perspectives on HTML...New Perspectives on HTML and XHTML 5...

    Partrick Carey

    New $67.45

    HTMLHTML

    Gary B. Shelly, Th...

    New $84.55

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    Dreamweaver CS3Dreamweaver CS3

    David McFarland

    New $29.69


    Of Interest:
  • And, Or, Equal, Not Equal, Greater Than, Less Than in Perl
  • Renaming a File with Perl's RENAME Function
  • Create or Put Items into an Array in Perl
  • Add to the Beginning of an Array with Unshift in Perl
  • Javascript Shift - Use Shift to Remove Items from the Beginning of an Array in Javascript
  • Make a String into a Link in Javascript
  • Javascript Reset Form
  • Javascript SetTimeout
  • HTML Center
  • HTML Font Code
  • HTML Link
  • HTML Forms

  • More Articles:
  • Use chmod in Perl
  • Exit a Script or Subroutine in Perl
  • Write a WHILE LOOP in Perl, Carefully
  • Encryption with the Crypt Function in Perl
  • onClick Javascript
  • Getting Epoch Time in Javascript
  • Splitting an Array using Javascript
  • Opening a REMOTE WINDOW in Javascript
  • Use onLoad in Body Tag with Javascript
  • HTML Title Tag
  • Make Text Bold Using HTML
  • HTML Codes
  • HTML Color Codes

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    421,768
    Counter by iLoveTheCode.com


    Last Modified: Sunday, 06-Apr-2008 06:09:00 EDT