No more false postfix lexical declarations in v5.30

Before Perl v5.10 introduced state variables, people did various things to create persistent lexical variables for a subroutine. With v5.30, one of those constructs is now a fatal error.

Often you want a persistent variable to be scoped and private to a subroutine. But, once you leave that scope, normal lexical variables disappear because their reference count drops to zero. So, no persistence.

Continue reading “No more false postfix lexical declarations in v5.30”

Experimental features now warn (reaching back to v5.10)

Perl 5.18 provides a new way to introduce experimental features in a program, augmenting the feature pragma that v5.10 added. This change marks certain broken v5.10 features as experimental with an eye toward possible removal from the language.

Smart matching in v5.10 led to several broken and conflated features. The given used a lexical version of $_, which broke many other common uses of that variable inside the given, which I explain in Use for() instead of given() and you can see in given/when and lexical $_ …. Continue reading “Experimental features now warn (reaching back to v5.10)”