|
I'm building a simple search function. Follows is a (stripped down) functional script:
use Win32::GUI;
use File::Find::Rule;
my $main = Win32::GUI::Window->new(
-name => 'Main',
-text => 'Test',
-width => 225,
-height => 100,
);
$main->Center();
my $Pattern = $main->AddTextfield(
-left => 100,
-top => 10,
-prompt => " List Files Named:",
-height => 20,
-width => 100,
-text => "*.*",
);
my $GoButton = $main->AddButton(
-name => "GoButt",
-size => [75,25],
-text => "Start Search",
-pos => [70,35],
);
$main->Show();
Win32::GUI::Dialog();
sub GoButt_Click {
my $pt = $Pattern->Text;
my $found_files = find(
name => "$pt",
maxdepth => 1,
exec => \&show_it,
in => ("c:\\"),
);
}
sub show_it {
print "@_[2]\n";
}
sub Main_Terminate {
return -1;
}
sub Exit {
return -1;
}
The function works very well, but I'd like to make it case-insensitive. I've tried everything I can think of to convert $Pattern->Text to a regex so I can use /i but I keep ending up with a reference instead of the referent. At least, that's what appears to be happening. I've also spent time trying to build $found_files->name as a literal string but I'm just not getting it.
Obviously, I'm a newbie to Perl. I can't help but think I'm not seeing the forest for the trees; this is too common a feature to cause me this much trouble. Could someone please buy me a clue with an explanation of technique or even an example?
TIA,
LawnBoy
|