Re: data manipulation

From: Bob (bNOoONb_at_not.pilbara.net.au)
Date: 10/10/03


Date: Fri, 10 Oct 2003 23:37:43 +0930


"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnbod9bh.4eg.tadmc@magna.augustmail.com...
> Bob <bNOoONb@not.pilbara.net.au> wrote:
>
>
> [ snip yet another full-quote. Please learn to quote followups properly ]
>
>
> > if (@ARGV == "0" ) {
>
>
> Why use a numeric operator and then force stringification?
>
> If you want to test a number, use a number and a numeric operator:
>
> if (@ARGV == 0 ) {
>
> If you want to test a string, use a string and a string operator
>
> if (@ARGV eq "0" ) {

Ok, what I am trying to test for is the existance of an argument, - if
@ARGV is NULL .... do something..... what I use works, but if there is a
better way of testing for a NULL than a numerical comparison? am open to
suggestions.... In this case, where the array is empty, a numeric test
returns "0", so the test made sense.

>
>
> > print "\n\tqmail-qreadto \{ email to search for\} \n";
> ^ ^
> ^ ^
>
> A useless use of backslashes.
>
>

only quoted as when I was testing a warning was generated, but I later found
the real problem.....

> > print "\t\texample\: qmail-qreadto me\@example.net \n\n";
> > exit 0
>
>
> You should exit with a *non* zero value when an error occurs.
>
>

I am exiting without an error here , simply if() do something exit -this
is just as valid an exit from the code as any other exit, and no error has
occurred.

> > open (MyFILE, $file2);
>
>
> You should always, yes *always*, check the return value from open():
>
> open(MyFILE, $file2) or die "could not open '$file2' $!";
>

In this case, I know that 1 of the 2 files will always exist, so I did not
"or die" here, but for the sake of consistency I will add it.

I appreciate the feedback given, and suggestions made.

Bob



Relevant Pages

  • Re: data manipulation
    ... Bob wrote: ... Why use a numeric operator and then force stringification? ... If you want to test a number, use a number and a numeric operator: ... If you want to test a string, use a string and a string operator ...
    (comp.lang.perl.misc)
  • Re: data manipulation
    ... >> Why use a numeric operator and then force stringification? ... >> If you want to test a string, use a string and a string operator ... Yep, simple boolean context. ...
    (comp.lang.perl.misc)
  • Re: some well known stupidness in c99
    ... exit("some string") For me cleaver improvements are nice. ... exit status of some kind. ... that is defined by the C standard: ... what can happen are determined by the host environment, ...
    (comp.lang.c)
  • Re: Ein bisschen Assembler
    ... EAX für FloatToDecimal -> Digits ... current_variable: String; ... : expr { ...
    (de.comp.lang.delphi.misc)
  • Re: Excel ActiveX TextBox Question
    ... You can use the Exit event to test whether the user should be allowed ... Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) ... Then test the state of the SHIFT key: ... process the full string after the user hits "Enter". ...
    (microsoft.public.excel.misc)