in reply to Re: Help for a beginner
in thread Help for a beginner

Thank you so much. That worked. What was the $strComputer doing? I thought that you had to have that in there so that if nothing was called out it would default to the local host.

Replies are listed 'Best First'.
Re^3: Help for a beginner
by agianni (Hermit) on Mar 02, 2007 at 19:37 UTC
    You're simply overwriting it with the assignment operator on line 12. A common way to deal with ensuring a default value is set is through the use of a C -style OR:
    $strComputer = $ARGV[0] || '.';

      Of course be careful using this idiom if "0" is a valid value (in that case an assign-the-default-first-and-overwrite implementation is better).

      Although it derives from C (many of Perl's operators do), I doubt it is useful to call || a "C style or". It's much more helpful to call it a "locical or" to distinguish it from | which is a "bitwise or" (also found in C). The third variant 'or' is called "binary or" by the way.


      DWIM is Perl's answer to Gödel