in reply to Re: why each/keys/values can't work on slice?
in thread why each/keys/values can't work on slice?

well,that’s just a example, slice could contains single elements and range even like @bb1,3,-1 etc.IMHO, slice is an accessor of array. So I am really curious why Perl emphasize keys,each only work on array and hash except for slice.
  • Comment on Re^2: why each/keys/values can't work on slice?

Replies are listed 'Best First'.
Re^3: why each/keys/values can't work on slice?
by ikegami (Patriarch) on Jan 11, 2023 at 19:04 UTC

    Then you could use 1, 3, -1 instead of keys @bb[ 1, 3, -1 ].

    Generally speaking,

    You could use LIST instead of keys @bb[ LIST ].

    You could use @bb[ LIST ] instead of values @bb[ LIST ].