%opts{'x'} value length test?

[email protected]
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <OF283DA6DC.0D5F7F12-ON8625775A.005264B4-8625775A.00530BF1@walgreens.com>
Gurus,

A simple thing, but it's driven me crazy.

        my %opts;
        getopts( 'ahp:r:s', \%opts);

Now, assuming that -r was passed to the program on invocation, how can I 
verify that the required argument was included?

I've tried this:

        ($opts{'r'} and (length($opts{'r'}) == 0) && die "argument 
required!";

but it doesn't work--though it seems like it ought to.  Tried a few other 
things, too, to no avail.  About ready to use a large hammer. Any 
alternative suggestions appreciated.

Thanks!

Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
224-542-5150

We sleep soundly in our beds because rough men stand ready in the night to 
visit violence on those who would do us harm. -- George Orwell

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.