in reply to Re: if elsif else question
in thread if elsif else question

There are several things wrong with /5.1/ The solution is to anchor the regex at the start and end of the string, and to escape ".": /^5\.1$/

eq is a far better operator when you want to test if two strings are equal!

See perlretut for a regexp tutorial and perlre for the full monty on regular expressions.


Unless I state otherwise, all my code runs with strict and warnings

Replies are listed 'Best First'.
Re^3: if elsif else question
by sub_chick (Hermit) on Jun 02, 2008 at 19:45 UTC
    My mistake on forgetting to add the escape char:  '\' before '.' :)
    Thanks.


    Es gibt mehr im Leben als Bücher, weißt du. Aber nicht viel mehr. - (Die Smiths)"
Re^3: if elsif else question
by linuxer (Curate) on Jun 02, 2008 at 19:37 UTC

    oops, how did I miss that special regex meaning of "."?