On Thu, 4 May 2000, Scott K Purcell wrote:

> hello,
> I am sorry to ask, but I can't seem to find this kind of statement in my 
> book or in the documentation.
> 
> $text = defined($ARGV[0]) ? $ARGV[0] : "Hello world";
> 
> PS, the end makes sense, that if there is a $ARGV[0] being passed to use 
> it, and if not use the "hello world", but what is that defined($ARGV[0]) 
> all about?????
>

The "truth" difference between $ARGV[0] and defined($ARGV[0]) occurs when
$ARGV[0] == 0 or $ARGV eq "" (i.e. the empty string). Both of the values
are defined but neither is true. Any other value would both be true and
defined.  As coded, the string "hello world" would be assigned to the
variable $text only in two cases. Case 1 is when no paramater at all is
provided and the second case is of course when the paramter value provided
is "hello world". The @ARGV array is populated with the command line
parameters, if there are any otherwize @ARGV is undefined and any
element of @ARGV that is referenced, e.g. $ARGV[0], is also undefined. 

**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****


---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to