In the discussion of ?PATTERN?
, perlop
states "This usage is vaguely deprecated". Does this mean that the ??
matching operator itself will be removed from perl, or does it mean that its semantics will change? Is using ??
a bad idea, or can that warning in perlop be ignored?
I would assume it means more or less what it says:
This usage is vaguely deprecated, which means it just might possibly be removed in some distant future version of Perl, perhaps somewhere around the year 2168.
So that means they'll remove it when they release Perl 6.
I kid, I kid. I would assume "vaguely deprecated" would mean that it's not a terrible construct, but you might want to rethink your design. I personally didn't even know what it was (or that the reset()
function even existed) until I looked it up just now, and having seen it, I don't know if I would ever use it for anything. The example they give in perlop is a bit cryptic:
while (<>) {
if (?^$?) {
...
}
} continue {
reset if eof;
}
I would write the equivalent and more obvious:
my $reset = 1;
while (<>) {
if ($reset and /^$/) {
...
$reset = 0;
}
} continue {
$reset = 1 if eof;
}
It's more verbose, but it's a little more obvious and easier on the brain (and maintainer).
Did you not read the rest of the sentence? It seems clear enough:
This usage is vaguely deprecated, which means it just might possibly be removed in some distant future version of Perl, perhaps somewhere around the year 2168.
To me, that says that the maintainers of Perl don't like the special-case behavior and would rather that people didn't use it but have no plans to change it.
It's safe to use. It would have to go through a real deprecation cycle (which can last quite a while) before it would be removed. That said, I wouldn't use it. This feature is esoteric enough that it could easily confuse whomever ends up maintaining your code (which could be future you).