# glob without args defaults to $_
$pat = $_ unless defined $pat;
- # extract patterns
- if ($pat =~ /\s/) {
+ # assume global context if not provided one
+ $cxix = '_G_' unless defined $cxix;
+
+ # if we're just beginning, do it all first
+ if (!$entries{$cxix}) {
+ # extract patterns
+ if ($pat =~ /\s/) {
require Text::ParseWords;
@pat = Text::ParseWords::parse_line('\s+',0,$pat);
- }
- else {
+ }
+ else {
push @pat, $pat;
- }
+ }
- # Mike Mestnik: made to do abc{1,2,3} == abc1 abc2 abc3.
- # abc3 will be the original {3} (and drop the {}).
- # abc1 abc2 will be put in @appendpat.
- # This was just the esiest way, not nearly the best.
- REHASH: {
+ # Mike Mestnik: made to do abc{1,2,3} == abc1 abc2 abc3.
+ # abc3 will be the original {3} (and drop the {}).
+ # abc1 abc2 will be put in @appendpat.
+ # This was just the esiest way, not nearly the best.
+ REHASH: {
my @appendpat = ();
for (@pat) {
# There must be a "," I.E. abc{efg} is not what we want.
}
goto REHASH;
}
- }
- for ( @pat ) {
+ }
+ for ( @pat ) {
s/\\{/{/g;
s/\\}/}/g;
s/\\,/,/g;
- }
- #print join ("\n", @pat). "\n";
+ }
+ #print join ("\n", @pat). "\n";
- # assume global context if not provided one
- $cxix = '_G_' unless defined $cxix;
-
- # if we're just beginning, do it all first
- $entries{$cxix} ||= [doglob(1,@pat)];
+ $entries{$cxix} = [doglob(1,@pat)];
+ }
# chuck it all out, quick or slow
if (wantarray) {