Re: Case insensitive file open in Perl

Steven Saner <[email protected]>
Newsgroups gmane.org.user-groups.aclug.discussion
Message-ID <[email protected]>
On Nov 2, 2009, at 7:50 PM, Nate Bargmann wrote:

> Maybe I'm just braindead tonight (likely as it seems as though I've  
> not
> adjusted to the time change yet).
>
> I'm working on a program that will load a user supplied file.  Since
> the file will be downloaded from the Web, it's possible that it will  
> be
> all upper case, all lower, or a mixture.  Nice, huh?
>
> I'm trying to recall how one goes about doing a case insensitive  
> search
> for the filename.  I know that I can use the //i matching operator.
> Would a foreach loop and passing each glob by the /filename.ext/i  
> match
> be the way to go?

That would work. You could also use lc() or uc() to convert each  
filename to all lower or upper case and then do a simple eq conditional.

Steve

--
---------------------------------------------------------------
Steven Saner
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.