hyphen vs minus in regex

Discussion in 'Perl' started by mm, Sep 8, 2003.

  1. mm

    mm Guest

    In a regular expression,
    is a hyphen simply -
    whereas a minus sign is \-
    I am trying to understand the code below:

    $addend_two = (rand 200) - 100;

    $addend_two =~ /(\-?[\d]+)\.?[\d]*/ ? $intPart2 = $1 : die "No
    integral value\n" ;
     
    mm, Sep 8, 2003
    #1
    1. Advertising

  2. mm

    dw Guest

    "mm" <> wrote in message
    news:...
    > In a regular expression,
    > is a hyphen simply -
    > whereas a minus sign is \-
    > I am trying to understand the code below:
    >
    > $addend_two = (rand 200) - 100;
    >
    > $addend_two =~ /(\-?[\d]+)\.?[\d]*/ ? $intPart2 = $1 : die "No
    > integral value\n" ;


    a minus and a hyphen are both simply -
     
    dw, Sep 8, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gilbert Saint-Flour

    non-breakable hyphen

    Gilbert Saint-Flour, May 17, 2004, in forum: HTML
    Replies:
    2
    Views:
    1,863
    Philipp Lenssen
    May 17, 2004
  2. KellyJ
    Replies:
    0
    Views:
    436
    KellyJ
    Jul 7, 2006
  3. Joe Stateson
    Replies:
    3
    Views:
    418
    Joe Stateson
    Oct 25, 2007
  4. Prasad
    Replies:
    6
    Views:
    467
    Joe Kesselman
    Oct 31, 2007
  5. Rey
    Replies:
    2
    Views:
    3,512
    warrenvt
    Jun 19, 2008
Loading...

Share This Page