Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pattern Modifier /i (for case)

Status
Not open for further replies.

jez

Programmer
Joined
Apr 24, 2001
Messages
370
Location
VN
Hi there,

I am having some problems with case sensitivity.
I am trying to provide links to documents, the names of which are in an @array, built from scanning a directory.
I am using a separate %hash to store the titles of the documents, provided by an index file, that lists the file names and their titles.
Using a loop through the array, I am creating links to the documents, with the text of the link being the docuemnt title.
This all works but it trips over if there is a case difference between the data in the array (src = from sys info), and the hash values (src = user updated index file).

Is there a way to globally turn off case sensitivity?

I have used the i modifier in regex but when i call the hash or loop through the array I can't see where I could put it?--;-

##array population

opendir(GSTR, $gfile) || die "Cannot scan directory $gfile: $!\n";
@gfiles =grep(!/^\.\.?$|\.dat$/, readdir GSTR);
closedir(GSTR);

##calling the values;-

foreach $gf(@gfiles) {
print &quot;<a href='$gfrelpath$gf' target='_blank'>$bash{$gf}</a><br>&quot;;
#print $gf;}

I need the $gf from the loop to match the key entry in
%bash, otherwise it doesn't work.


Any help would be great, thanks


Jez

:-)
 
You can use the uc (uppercase) or lc (lowercase) functions on both to make sure they are both in the same case.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thanks,

I have experimented with this now and managed to use both lc and uc to get the matches I need in the script but then also to make the on screen output look as it did before (that is with mixed uc/lc chars).

I thought there was something like this but I just couldn't find it.

Thanks again,

Jez

:-):-):-)
;-)
:-):-):-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top