David <[EMAIL PROTECTED]> wrote:
> i agree. the part that make people confuse is that most people 
> think $| is a variable holding a number. that's not necessary 
> the case. Perl could have(easily) implmented $| to be a bit
> (save memory and faster access and manipulation etc) position 
> of a number. many c functions does that.

It *is* a bit, actually...

Perl filehandles look like:

struct xpvio {

    [ big snip ]

    long    xio_lines;          /* $. */
    long    xio_page;           /* $% */
    long    xio_page_len;       /* $= */
    long    xio_lines_left;     /* $- */
    char *  xio_top_name;       /* $^ */
    GV *    xio_top_gv;         /* $^ */
    char *  xio_fmt_name;       /* $~ */
    GV *    xio_fmt_gv;         /* $~ */
    char *  xio_bottom_name;    /* $^B */
    GV *    xio_bottom_gv;      /* $^B */
    short   xio_subprocess;     /* -| or |- */
    char    xio_type;
    char    xio_flags;
};

The "autoflush" for a given filehandle is a bit in the 
xio_flags, and get/setting $| just toggles that bit.

It affects the "default" filehandle, which is STDOUT
or whatever you select().

And see also the IO::Handle manpage... all these magic
globals to influence the "current" or "default" filhandle
turn into well-behaved, orderly methods of that class.

> when you assign something to it, it merely sets this bit 
> to 0 or 1 but not actually assigne any value to it. 

Exactly.  The actual value you assign is ignored, and only
tested for truth/falseness.

-- 
Steve

perldoc -qa.j | perl -lpe '($_)=m("(.*)")'

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to