Lexical readonly state variables with PerlX::Let
I’ve released a new module PerlX::Let that adds a new “let” keyword so that you can do the following:
let $x = 1,
$y = "string" {
if ( ($a->($y} - $x) > ($b->{$y} + $x) )
{
something( $y, $x );
}
}
with this, you can have lexical readonly variables, and avoid bugs due to typos.
A nice feature of this is that it uses state variables if the assigned value is a constant, and the value is a scalar (for Perls older than 5.28).
Leave a comment