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

I didn't explain %{ $_[0] }; I explained why %$_[0] is nonsense.

Maybe adding spaces and parens will help?

keys( %$_ ) keys( %$_ ) [0] Nonsense keys( %$ ); [0] `;` = End of statement keys( %$ ) # [0] `#` = Comment keys( %$ ) ^ [0] `^` = Binary op keys( %$ ) & [0] `&` = Binary op keys( %$ ) = [0] `=` = Binary op keys( %$ ) | [0] `|` = Binary op keys( %$ ), [0] `,` = Binary op keys( %$ ) < [0] `<` = Binary op keys( %$ ) > [0] `>` = Binary op

Replies are listed 'Best First'.
Re^4: keys on scalar warnings and lack thereof
by LanX (Saint) on May 18, 2026 at 10:19 UTC
    > I explained why %$_[0] is nonsense

    Please note that since 5.20 this alone is no nonsense anymore.

    Though applying keys on it is not allowed/making sense.

    See my last post

    > keys( %$_ ) [0] Nonsense

    This is not what happens, but

    keys ( %{$_}[0] )

    Update

    Demo in debugger

    $perl -db0 ... DB<4> $_ = [ qw/a b c d/ ] DB<5> x %$_[0,2,1] 0 0 1 'a' 2 2 3 'c' 4 1 5 'b' DB<6> say %$_[0,2,1] 0a2c1b DB<7> p $] 5.040003

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