develooper Front page | perl.perl5.porters | Postings from May 2021

evalbytes example?

Felipe Gasper
May 19, 2021 15:27
evalbytes example?
Message ID:
Hi all,

	Would someone here who understands the matter be able to paste a quick code example that demonstrates the difference between eval and evalbytes, and what the unicode_eval feature does?

	I don’t get what the practical difference is from the documentation, and I see no effect in various samples I’m trying.

	The only difference at *all* that I see is that evalbytes downgrades the string:

my $e_bytes = q<"é">;

my @values = (
	eval( $e_bytes ),
	CORE::evalbytes( $e_bytes ),

use Devel::Peek;
Dump $_ for @values;

… but that’s internal to Perl, so I don’t get why there are 2 features for it. And no difference whether the above runs under unicode_eval or not.

	I’ve asked in IRC and perused the p5p archives but gotten nowhere. Per this:

… it seems like `eval("'\x{100}'")` is supposed to behave differently under unicode_eval, but I see no such difference.

	Thank you!

-Felipe Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About