in reply to Re^2: keys on scalar warnings and lack thereof
in thread keys on scalar warnings and lack thereof

What exactly do you expect from broken code?

$ perl -E' $_[0] = {}; say keys %$_[0]' Experimental keys on scalar is now forbidden at -e line 1. Type of arg 1 to keys must be hash or array (not index/value array sli +ce) at -e line 1, at EOF Execution of -e aborted due to compilation errors.

Please note the not index/value array slice , because that's what's fed into keys.

Try keys %{$_}[0] and compare the error messages...

Update

Admittedly, I've never used this before: Index/Value-Array-Slices

Update

> And all the other weird looking results?

In the other attempts with special variables parsing is "broken". Use B::Deparse to check by your self.

Perl should theoretically see %$^[0] etc as %{$^}[0] but doesn't , and I'm neither surprised nor shocked.

These variables are not meant to hold array or hash refs, and skipping punctuation while parsing seems like an acceptable bug and might avoid other worse problems.

Feel free to file a bug report, I doubt this will get a high priority.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery