Loading ...
Sorry, an error occurred while loading the content.

doubt in perl regular expression

Expand Messages
  • senthil kumar
    if($word=~/ant+/) { print matched ; } else { print not matched ; } print n ; what is the output of this code: plz explain me i m trying to write regular
    Message 1 of 4 , Feb 21, 2006
    • 0 Attachment
      if($word=~/ant+/)
      {
      print "matched";
      }
      else
      {
      print " not matched";
      }
      print "\n";
      what is the output of this code:

      plz explain me
      i m trying to write regular expression for palindrome checking,upper case nd lower case conversion .
      for upper case and lower case upper cases and lower cases in word are chnaged to upper case and lower case respecdtively.
      eg:sENTHIL ..this is going to be expected as Senthil
      output:Senthil
      another one doubt is how to get ascii value of the numbers and the alphabets..
      $love="senthil kumar";
      $love=~tr/senthil/kumar/;
      print $love;
      print "\n";
      output is
      kumarrr kumar.can we get ouput using tr.we can get using substtuition.
      because senthil has 7 letters in itbut replacing kumar has 5 letters in it. so r is placed three times.
      but i want the word kumar kumar
      plz help me
      bye
      take care
      senthil


      ---------------------------------
      Yahoo! Mail
      Use Photomail to share photos without annoying attachments.

      [Non-text portions of this message have been removed]
    • Dave Cross
      senthil kumar wrote: [ snip ] ... Senthil, This mailing list is for the discussion of Extreme Programming practices as they relate to Perl. It is not a place
      Message 2 of 4 , Feb 22, 2006
      • 0 Attachment
        senthil kumar wrote:

        [ snip ]

        > plz help me

        Senthil,

        This mailing list is for the discussion of Extreme Programming practices
        as they relate to Perl. It is not a place to get general Perl help.

        You'd be better off asking your question on Perl Monks
        (http://perlmonks.org/) or on one of the Learn Perl mailing lists
        (http://learn.perl.org/).

        Cheers,

        Dave...

        --
        Site: http://dave.org.uk/
        Blog: http://blog.dave.org.uk/
        Code: http://dave.org.uk/code/
      Your message has been successfully submitted and would be delivered to recipients shortly.