develooper Front page | perl.perl5.porters | Postings from September 2022

Pre-RFC: ${^UNPACKED_LENGTH}

Thread Next
From:
Felipe Gasper
Date:
September 20, 2022 17:43
Subject:
Pre-RFC: ${^UNPACKED_LENGTH}
Message ID:
84D8D544-392A-4BCB-9283-EDF84AC3855C@felipegasper.com
Hi all,

	I just wrote some code that unpacks binary messages of unknown size. Example:

$str = unpack 'L L/a* L L/a* L ', $bytes;

	When I’m done unpacking, I want to discard the stuff I’ve unpacked. In default of something in Perl, though, that tells me how many bytes/characters it’s unpacked, I have to re-compute that length.

	Would a ${^UNPACKED_LENGTH} global, which would give that information to callers, be a sensible language addition?

	Thanks!

-FG

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About