On Wed, Jan 30, 2002 at 10:47:49AM +0100, Bart Lateur wrote: > On Wed, 30 Jan 2002 14:17:01 +1100, [EMAIL PROTECTED] wrote: > > >but then I remembered a post by Perl Monk tilly (something > >about a color chart) where he used glob in a most perverse way. > >I had never done this myself, however, so I started with a small > >program: > > > >@a = glob('|y|{a,e,i,o,u,y,}||c'); > >for my $x (@a) { print "x=$x\n" } > > > >This produced a list of just the type I wanted! > > OK, for the people who haven't seen that post... how does it work? Even > on stupid Win98, FGS! > > Isn't glob() supposed to return only files that actually exist?
No. glob() returns the files that exists, but only if there exists at least one. Otherwise, it just does the { } expansion, and leaves things as is. Just like in *some* shells. bash $ echo yy* yy* bash $ echo y?y y?y bash $ echo y{a,e,i,o,u,y,}y yay yey yiy yoy yuy yyy yy ksh $ echo yy* yy* ksh $ echo y?y y?y ksh $ echo y{a,e,i,o,u,y,}y y{a,e,i,o,u,y,}y csh % echo yy* echo: No match csh % echo y?y echo: No match csh % echo y{a,e,i,o,u,y,}y yay yey yiy yoy yuy yyy yy Abigail