Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've used perl's array slices as

  @array[@indices]
in the past. Can't remember why, but I have. It also works for hashes:

  %hash = (foo => "bar", one => "two", alpha => "beta");
  @keys = ('alpha', 'one');
  @hash{@keys} == ('beta', 'two');


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: