in reply to Truth & Whitespace

You would rather load a module instead of adding an extra line of code? Interesting...
If you just want to keep it to one line though, you could always do this:
$name = $name=~tr/ //c ? $name : 'Guest';
--perlplexer

Replies are listed 'Best First'.
Re: Re: Truth & Whitespace
by goofball (Acolyte) on May 02, 2003 at 17:20 UTC
    The reason I would rather load a module is that I already have a couple sites with about 5000 scripts (slight exageration).
    They all require a single .pl file that loads standard code and creates standard variables.
    So loading a module in this standard.pl file would be much easier than searching 5000 scripts for uses of $a ||= $b statements and replacing all that plus an extra line of code.
      I would fix all 5000 scripts. You have a logic flaw and trying to work around it will:
      1. Take at least as long, and probably longer than just fixing it
      2. Will never reduce the number of problems to zero.
      3. Is plain old stubborn when flexible is called for.
      Your problem has to do with the fact that you're not handling the string right. You should be figuring out the name, then adding the salutation. Don't add the salutation until you know the name! Sounds pretty cut'n'dry to me ...

      ------
      We are the carpenters and bricklayers of the Information Age.

      Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

      Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.