use strict;
use vars qw( %Config );
use File::DosGlob ?glob?;
use Getopt::Long;
my $iCount = 0;
my @Dirs;
Configure( \%Config );
if( $Config{help} )
{
	Syntax();
	exit;
}
map
{
	# File::DosGlob only supports UNIX slashes (not Win32 backslashes)
	$_ =~ s////g;
	# File::DosGlob requires all spaces to be escaped with an escaping backslash
	$_ =~ s/(s)/$1/g;
	push( @Dirs, $_ ) if( «» eq $_ );
} split( «;», $ENV{$Config{variable}} );
foreach my $Mask ( @{$Config{mask_list}} )
{
	# Escape all spaces in the mask with a backslash
	$Mask =~ s/(s)/$1/g;
	foreach my $Dir ( @Dirs )
	{
		foreach my $File ( glob( «$Dir/$Mask» ) )
		{
			next unless( -f $File );
			# For the sake of Windows users convert UNIX slashes to Win32 backslashes
			$File =~ s////gs;
			printf( « % 3d) %s
», ++$iCount, Win32::GetLongPathName( $File ) );
		}
	}
}

sub Configure
{
	my( $Config ) = @_;
	my $Result;
	$Config->{variable} = «PATH»;
	Getopt::Long::Configure( «prefix_pattern=(-|/)» );
	$Result = GetOptions( $Config,
			qw(
			variable|v=s
			help|?
			) );
	push( @{$Config->{mask_list}}, @ARGV );
	$Config->{help} = 1 if( ! $Result || ! scalar @{$Config->{mask_list}} );
}

sub Syntax
{
	my ($Name) = ($0 =~ /([^/]*)$/);
	my ($Space) = « « x length( $Name );
	print<