Hi monks
slice is of course a powerful expression in perl, which many other languages borrow it. but why each/keys/values can't work on it? is difficult to implement? Please enlighten me.
C:\Users\Administrator>perl -E"my @bb = 1..10; for(keys @bb[1..5]){say +;} Experimental keys on scalar is now forbidden at -e line 1. Type of arg 1 to keys must be hash or array (not array slice) at -e li +ne 1, near "])" Execution of -e aborted due to compilation errors. C:\Users\Administrator>perl -E"my @bb = 1..10; @cc = @bb[1..5]; for(ke +ys @cc){say;} 0 1 2 3 4
In reply to why each/keys/values can't work on slice? by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |