in reply to Re^3: Annoying whitespace(s)...
in thread Annoying whitespace(s)...

Thanks Corion,

I stand corrected. It is nice to see the differences in coding and grammer that are used around the globe.

My mistake...

$Buffer = '/0';
... unless it is impossible to write a NULL character to a character string.

Thanks for the nod for  use strict and  use warnings. I am new to Perl, and I may take this opportunity to say, Perl is wierd but necessary. I will investigate 'taint' mode.

Like I said the 'read into buffer and then write out' method was inherited from FormMail, I thought it was dodgy at the time, but then thought that's the way perl scripts work. I realise that a large mailing list would ruin a cache in microseconds. The reason I didn't include his name was that there is <20% of his code remaining.

The rest of your comments I don't really agree with, prbably primarily because I want to keep this script to a single file.

Thanks again, R

Replies are listed 'Best First'.
•Re^5: Annoying whitespace(s)...
by merlyn (Sage) on Sep 05, 2004 at 22:34 UTC
    prbably primarily because I want to keep this script to a single file.
    Uh, why? Your computer doesn't care how many files the program is.

    Unless (gasp) you are writing this to share. Ugh. Please don't. We already have enough mediocre Perl code written by budding newbies.

    And you still have a lot to learn... your updated code is still wrong:

    $Buffer = '/0';
    So you aren't even paying attention to what you're being told. This makes you dangerous. Please stop now. Go get a good book or two on Perl, read up, then go back to coding, and don't share your code to unsuspecting individuals until you've had a thorough audit by an expert.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^5: Annoying whitespace(s)...
by Errto (Vicar) on Sep 05, 2004 at 22:38 UTC

    To further clarify, the reason why $Buffer = '/0'; is still wrong:

    First of all, you need to understand the difference between single quotes and double quotes in Perl. If you wanted to populate the buffer with a single null character, you would say $Buffer = "\0";. Note the double quotes and the backslash instead of forward slash.

    Second, you don't want to populate a buffer with a null character. In Perl this is not necessary. Perl takes care of allocating memory for strings for you. This was mentioned by Corion but you seem to have missed that part of the reply.