RefElem(3pm)

✨ NAME ✨

Array::RefElem β€” setting up array elements as aliases, bestie πŸ’…

Like, this module is in Array::RefElem, and the whole vibe is: what if an array slot and a variable were literally the same thing? No copying, no middleman, just pure aliasing energy πŸ¦‹


✨ SYNOPSIS ✨

use Array::RefElem qw(av_store av_push hv_store);

av_store(@a, 1, $a);
av_push(@a, $a);
hv_store(%h, $key, $a);

okay so you import the three functions, and then you're off to the races πŸŽ€


✨ DESCRIPTION ✨

So here's the tea β˜• β€” this module hands you direct access to some of the internal Perl routines that let you store things in arrays and hashes. No cap. It's giving backstage pass to perl's guts 🌸

The following functions are available:

  • av_store(@array, $index, $value) β€” Stores $value in @array at the specified $index. After you run this call, $array[$index] and $value denote the same thing. Same thing!! Not copies. Not twins. The same thing πŸ‘‘
  • av_push(@array, $value) β€” Pushes $value onto the @array. After you run this call, $array[-1] and $value denote the same thing. So the last element of the array is $value, fr fr πŸ’–
  • hv_store(%hash, $key, $value); β€” Stores $value in the %hash with the given $key. After you run this call, $hash{$key} and $value denote the same thing. Iconic behaviour, honestly 🫢
ngl, the entire point here is aliasing: write through one name, see it through the other. That's the whole slay πŸ’€βœ¨

✨ SEE ALSO ✨

  • perlguts β€” go read it if you wanna vibe with perl's internals 🧚

Copyright 2000 Gisle Aas.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🌈


and that's the whole page, bestie πŸ’œ this was RefElem(3pm) from perl v5.42.3, dated 2026-08-19 β€” tysm for reading, mwah, go alias something πŸŽ€βœ¨

πŸ“¦ where this page comes from