Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    21

    Question Unanswered: parsing a string

    How can i parse a string in perl(equivalent to substring() function in Sybase)?

    i have email address like John.Smith@mail.com.
    I need to get two things from it

    $Fullname = John.Smith
    $Last = Smith

    How can i do it ?
    Thanks

  2. #2
    Join Date
    Jun 2004
    Location
    Nowhere Near You
    Posts
    89
    If they alway conform to "FirstName.LastName@foobar.net" one could use
    Code:
     $_='FirstName.LastName@comcast.net'; 
     my($first,$full,$last);
     ($first,$last)=split(/\.|\@/,$_);
     ($full=$first).=" $last";

  3. #3
    Join Date
    Jun 2004
    Location
    Nowhere Near You
    Posts
    89
    S o r r y ! (double post)
    Last edited by senza_nome; 10-20-04 at 13:18.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •