I guess that the point of the patch of japhy described Why Is $& Bad? is more efficient obfuscation :)

But I was surprised by what I got when I executed the following code (using perl 5.006001). I have not gone thru the Perl sources to explain the behavior. Or I am missing something obvious?

So I ask you to answer without executing it: 1/ Does it compile 2/ If so, what does it do?

open *&, "/etc/printcap"; print "opened\n" unless eof( *&); print <&>;

-- stefp

Replies are listed 'Best First'.
Re: why is *& weird?
by japhy (Canon) on Sep 04, 2001 at 01:07 UTC
    I think <&> is globbing instead of reading from a filehandle.

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Re: why is *& weird?
by stefp (Vicar) on Sep 04, 2001 at 01:17 UTC
    That is indeed the right conclusion:
    perl -MO=Concise,-exec -e 'print <&>' 1ib <0> enter 1ic <;> nextstate(main 167 -e:1) v 1id <0> pushmark s 1ie <0> pushmark[t3] s 1if <$> const(PV "&") sM 1ig <$> const(IV 0) sM 1ih <$> gv(*CORE::GLOBAL::glob) s 1ii <1> entersub[t1] lKS/TARG,1 1ij <@> print vK 1ik <@> leave[t1] vKP/REFC

    -- stefp