Hello,
This is a rather stupid question but I'm no expert at Perl. I want to check to see if a file name contains the text '.mak' at the end of it's name and not '.mak.bak'. Currently my script searches all files that have the .mak extension as well as the .mak.bak extension. My code is
while ($file = readdir(MAKE))
{
if ($file =~ /.*\.mak$/)
{
open(FILE, $file) or die "Can't open the file $file: $!\n";
while ($line = <FILE>)
{ etc etc etc...
it opens not only the files with the .mak extension but also the files witht he .mak.bak extension. I figured that by putting the '$' at the end of the regular expression that this would take care of this problem, it hasn't. Any help is greatly appreciated.
Thanks
Mike
This is a rather stupid question but I'm no expert at Perl. I want to check to see if a file name contains the text '.mak' at the end of it's name and not '.mak.bak'. Currently my script searches all files that have the .mak extension as well as the .mak.bak extension. My code is
while ($file = readdir(MAKE))
{
if ($file =~ /.*\.mak$/)
{
open(FILE, $file) or die "Can't open the file $file: $!\n";
while ($line = <FILE>)
{ etc etc etc...
it opens not only the files with the .mak extension but also the files witht he .mak.bak extension. I figured that by putting the '$' at the end of the regular expression that this would take care of this problem, it hasn't. Any help is greatly appreciated.
Thanks
Mike