%opts{"x"} value length test?

%opts{"x"} value length test?

am 08.07.2010 17:07:04 von Deane.Rothenmaier

This is a multipart message in MIME format.
--===============0708844790==
Content-Type: multipart/alternative;
boundary="=_alternative 00530BDC8625775A_="

This is a multipart message in MIME format.
--=_alternative 00530BDC8625775A_=
Content-Type: text/plain; charset="US-ASCII"

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
--=_alternative 00530BDC8625775A_=
Content-Type: text/html; charset="US-ASCII"



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

--=_alternative 00530BDC8625775A_=--


--===============0708844790==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0708844790==--