in reply to Re: Re: Re: String Length
in thread String Length

What if I'm looking for "ST" or "TH" or "RD"? How would a regular expression help in this instance? ep

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: String Length
by dws (Chancellor) on Apr 04, 2001 at 23:41 UTC
    This is crossing the line between our helping out and our doing your homework for you. Read perlre.

    (Aimed that the Anonymous Monk, not ep.)

Re: Re: Re: Re: Re: String Length
by thabenksta (Pilgrim) on Apr 04, 2001 at 23:46 UTC
    $string =~ s/(.*).{2}$/$1/;
    will take ANY two characters off of the end of the string.

    my $name = 'Ben Kittrell'; $name=~s/^(.+)\s(.).+$/\L$1$2/g; my $nick = 'tha' . $name . 'sta';