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

Re: [PBML] urgent help needed

Expand Messages
  • Shawn H Corey
    ... The first character that follow an s is the delimiter. So the above is equivalent to: $variable =~ s/ / Z//; The meta-character Z will match an optional
    Message 1 of 3 , Jul 3, 2011
    • 0 Attachment
      On 11-07-02 12:48 AM, Minjal Pandejee - ASIC wrote:
      > Hi,
      >
      > I am a beginner in perl and I have a query regarding pattern matching.
      > I came across a line in perl where it was written
      > $variable =~ s-/\Z--;

      The first character that follow an s is the delimiter. So the above is
      equivalent to:

      $variable =~ s/\/\Z//;

      The meta-character \Z will match an optional newline and the end of the
      string. It is the same as:

      $variable =~ s/\/\n?$//;

      >
      > and as the code goes ahead some another variable was assigned
      > $variable1 =~ s-/--;

      It's equivalent would be:

      $variable1 =~ s/\///;

      >
      > can you please tell me what does these 2 lines do?
      > I want to know what does s-/\Z-- and s-/-- mean.
      >
      > Thanks& Regards
      > Minjal Pandejee
      >

      See:
      perldoc perlretut
      perldoc perlre


      --
      Just my 0.00000002 million dollars worth,
      Shawn

      Confusion is the first step of understanding.

      Programming is as much about organization and communication
      as it is about coding.

      The secret to great software: Fail early & often.

      Eliminate software piracy: use only FLOSS.
    Your message has been successfully submitted and would be delivered to recipients shortly.