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

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] || '.';

Replies are listed 'Best First'.
Re^4: Help for a beginner
by Fletch (Bishop) on Mar 02, 2007 at 20:32 UTC

    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).

Re^4: Help for a beginner
by GrandFather (Saint) on Mar 02, 2007 at 20:38 UTC

    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