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?????
>
> If anyone knows where an eg of this is, I would really appreciate.
>
> Thanks
> Scott
>
defined(x) is equivilent to (x != undef), except that you cannot say
that, so you use the defined keyword. If $ARGV[0] is undefined, then no
arguments were passed to the script.
Remember, this is NOT 'C'. In 'C', given:
int main(int argc, char **argv) {
...
then argv[0] is the name of the program that is being run. In Perl $0 is
the program and $ARGV[0] is a legit arg to the program.
---
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]