in reply to regex problem

use round brackets around your if statement...without the brackets it's probably testing (if $name), and there's nothing to bind the substitution to...and perl tries to use default $_ for the substitution which is empty.
the hardest line to type correctly is: stty erase ^H

Replies are listed 'Best First'.
Re^2: regex problem
by JavaFan (Canon) on Nov 03, 2010 at 23:56 UTC
    use round brackets around your if statement.
    No. Not needed.
    without the brackets it's probably testing (if $name),
    That doesn't make any sense.
    and there's nothing to bind the substitution to...
    And neither does that.

    Please, when answering a question, don't make wild guesses that can easily be verified (run it through -c -MO=Deparse, and you'll see you're not making any sense). Giving bad answers actually decreases the value of Perlmonks. Running the code through -c -MO=Deparse would have taken less time than typing in the answer - and hence would have saved you time. Would have saved me time as well.

    A reply falls below the community's threshold of quality. You may see it by logging in.