in reply to Re: $_ haters anonymou
in thread $_ haters anonymou

you don't want to have to say $main::^M everywhere.

i blinked b4 replying, but you don't have to:

$::^M is equivalent to $main::^M - 'main' is the default namespace.

Or have I grabbed the wrong end of a pointy stick?

cLive ;-)

Replies are listed 'Best First'.
Re: $_ haters anonymou
by Dominus (Parson) on Jan 25, 2002 at 19:05 UTC
    Says cLive ;-):
    $::^M is equivalent to $main::^M - 'main' is the default namespace.
    Actually they're both syntax errors.

    If they weren't syntax errors, then yes, the variable $::^M is identical to $main::^M. But not because main is the default namespace. It's because the empty stash name is interpreted as though you had said main instead. See line 579 of gv.c:

    if (!*name) return gv ? gv : (GV*)*hv_fetch(PL_defstash, "main::", + 6, TRUE);
    If the name turns out to have been empty, Perl looks up the main stash instead.

    --
    Mark Dominus
    Perl Paraphernalia