Huh, wow, that works...
Considering how many times I've used <> in its more "normal" usages, I'm surprised I never stumbled on this via a typo :)
And it's been that way since (at least) 5.8.8. That's as far back as the perldoc.perl.org site goes.
| [reply] |
And after getting used to mixing readline and glob behavior inside <...> , you'll probably find it more irritating that glob is also used to generate recombinations of strings without reading the file system
If non-empty braces are the only wildcard characters used in the glob, no filenames are matched, but potentially many strings are returned. For example, this produces nine strings, one for each pairing of fruits and colors:
my @many = glob "{apple,tomato,cherry}={green,yellow,red}";
Reason is, Perl started as shell° scripting on steroids, it had to compete with similar glob mechanisms there.
(I'm using this feature often, but am still irritated)
°) well <{ba,k,c,}sh> scripting if you want ;)
| [reply] [d/l] [select] |
The globbing feature of the <> operator dates back at least as far as the Perl-5.5.* versions, as it appeared in some of my earliest Perl books (Learning Perl, 2nd Ed; Programming Perl, 2nd Ed). That takes us into the late 90's.
| [reply] [d/l] |
I'm pretty sure <> as glob has been around since pretty close to the beginning of time as far as perl is concerned. It was present in Perl 4.
A quick look in the git log of the perl5 repository shows commentary about it from Jun 1988 in perl 2.0
| [reply] |