in reply to Re: Noob Question - not sure what's wrong
in thread Noob Question - not sure what's wrong

Thanks ikegami,
But I think I found what I was doing wrong. I simplified the code to this and it now works...

while ($sbNumHost1 !~ m/^(SB)(\d{1,2})$/i) { print "Enter the SB## \t: "; chomp($sbNumHost1 = ReadLine(0)); } print "done\n";

Replies are listed 'Best First'.
Re^3: Noob Question - not sure what's wrong
by ikegami (Patriarch) on May 11, 2011 at 15:52 UTC

    That matches "SB00\n" and you said it shouldn't. Replace /$/ with /\z/ to get the stated desired behaviour.

    \d can match more than 0-9. I presume you don't want to match arab digits.

    That uses needless captures. Get rid of them.

    m/^(SB)(\d{1,2})$/i
    should be
    m/^SB[0-9]{1,2}\z/i