Sign in to PrePAN

English::Control Like, but with ${^OFS} instead of $OFS



use English::Control;

my @words = 'English', 'Control', 'pm';
local ${^LIST_SEPARATOR} = "-";

print "@words\n"; # English-Control-pm


So I had this idea that would be better if, instead of storing its variables in each package (potentially clobbering other variables if somebody has forgotten that, for example, $LIST_SEPARATOR or $WARNING or $NR are special), it would be better if it stored its variables as control-character variables, like ${^LIST_SEPARATOR} or ${^NR}. These are reserved to perl, normally, and are forced to be in package "main" so they only need to be set up once (not imported for each module).

Anyway, so I wrote this module to make that happen. (I say "wrote", but mostly what I did, other than typing {^ and } a lot, was delete a bunch of stuff.)



As stated in perlvar: "These variables are reserved for future special uses by Perl". The only exception is those begin with ^_ (caret-underscore). It sounds like you think you're fixing a rare problem in the present by breaking stuff in the future.
You lose `strict vars` typo protection by doing it this way.
@automatonical - The idea was to promote this as an alternative to English and maybe someday become official. Or kinda official, anyway.

@ap I didn't realize that -- I guess they count as "fully qualified" because they're always in main?

I can see that there's a big downside with that, although it's the same one we have with perl's own special variables like ${^TAINT}, ${^GLOBAL_PHASE}, etc. Admittedly those are probably used less than stuff like $| and $/ . Definitely worth thinking about. Thanks.
I made changes to the documentation acknowledging these issues.

Please sign up to post a review.