Search code examples
perlglob

How does glob return 'filenames' that don't exist?


This answer indicates that glob can sometimes return 'filenames' that don't exist.

@deck = glob "{A,K,Q,J,10,9,8,7,6,5,4,3,2}{\x{2660},\x{2665},\x{2666},\x{2663}}";

However, that code returns an empty list when I run it.

What am I missing?


This run was from the command prompt using -e, on Windows XP, with ActiveState Perl version 5.005_02. Running from a saved script on the same machine yields the same results.

Running with -e on Windows XP, with ActiveState Perl v5.8.7, does return an array.


Solution

  • Perl version 5.005_02 is ancient (in Perl terms). That version probably has a different implementation of glob that doesn't return names of files that don't exist. As you've noticed, later versions of Perl work differently.