in reply to Re: Why I can't fetch any special variables ?
in thread Why I can't fetch any special variables ?

$< doesn't get created automatically.

Sure it does  perl -le " print defined $<"

As for $^X, "^X" is a convenient way of writing Ctrl-X. Yes, you can use a real Ctrl-X after the $ in the code, and in fact, that's the real variable name. You'll need to pass "\cX"c (or whatever the C equivalent is) to gv_fetchpv.

$^X is the actual name of the variable, so no, you don't need to use \cX, you can use $^X, the actual name of the variable

Replies are listed 'Best First'.
Re^3: Why I can't fetch any special variables ?
by ikegami (Patriarch) on Sep 15, 2011 at 05:41 UTC

    Sure it does perl -le " print defined $<"

    No, your use of it created it. Try

    perl -E'say for keys %::'

    $^X is the actual name of the variable

    Why are you contradicting two people without proof or argument?

    >perl -E"say ${ $::{'^X'} }" >perl -E"say ${ $::{qq{\cX}} }" ...\perl.exe

      Why are you contradicting two people without proof or argument?

      I'm not contradicting two people, i'm contradicting you, because perlvar contradicts you, you don't need \cX

        The OP also showed that the var isn't named "^X" and that it is named "\cX" before you claimed the opposite.

        Furthermore, perlvar doesn't contradict anything I said. In fact, it says exactly the same thing I said. perlvar specifically says that $^X is a "single-control-character names" and that Perl "understands ^X (caret X) to mean the control-X character". Yes, perlvar says that $^X is just an alias for $. It even specifically uses $^X as the example!

        >perl -le"print qq{print qq{\$\cX}}"
        print qq{$}
        
        >perl -le"print qq{print qq{\$\cX}}" | perl -l
        ...\perl.exe