Re: data manipulation
From: Bob (bNOoONb_at_not.pilbara.net.au)
Date: 10/10/03
- Next message: Gerhard Lausser: "Bug in File::Copy or my mistake?"
- Previous message: Jim Rendant: "Passing objects to a perl script via POST"
- In reply to: Tad McClellan: "Re: data manipulation"
- Next in thread: nobull_at_mail.com: "Re: data manipulation"
- Reply: nobull_at_mail.com: "Re: data manipulation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Gerhard Lausser: "Bug in File::Copy or my mistake?"
- Previous message: Jim Rendant: "Passing objects to a perl script via POST"
- In reply to: Tad McClellan: "Re: data manipulation"
- Next in thread: nobull_at_mail.com: "Re: data manipulation"
- Reply: nobull_at_mail.com: "Re: data manipulation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|