Welcome to YLOAN.COM
yloan.com » Gadgets and Gizmos » Using Perl to Convert Hyperlinks and Filenames to Lowercase
Gadgets and Gizmos misc Design Bankruptcy Licenses performance choices memorabilia bargain carriage tour medical insurance data

Using Perl to Convert Hyperlinks and Filenames to Lowercase

Using Perl to Convert Hyperlinks and Filenames to Lowercase


Like a lot of web developers, I'm not always that disciplined when it comes to the file naming convention I use and I sometimes end up with a situation whereby I have some files that are in lowercase, some that begin with a capital, and some that are a bit of a mixture.

One web site I maintain contains about 2000 web pages and has about 20,000 hyperlinks. As you can imagine, I had one of those sinking feelings when I was told that in order to migrate the web site to a new content management system, all the file names and hyperlinks would need to be changed to lowercase.

Whenever I am presented with a problem like this, my instinct is always to write a Perl script using one or more regular expressions to solve the problem. This particular situation was no exception.


Change a string to lowercase

The following regular expression changes all the characters in a string to lowercase. The first part of the regular expression finds a hyperlink, and the second part converts the string. (Just in case this article is not displayed correctly, there should be a single backslash in front of the 'L$1').

1. $line =~ s/ Change a filename to lowercase Likewise, changing a filename itself is very simple. The following two lines perform the task quite nicely: 1. use File::Copy; 2. move ("$name", "L$name");

(Again, there should be a single backslash in front of the 'L$name'.)

If you need more information on how to incorporate the above code snippets into a complete script, feel free to contact me directly.

Now Pay Close Attention --

Using Video Testimonials to increase your websites sales and revenue is simpler than you've been told. Everyone with a website faces the same two problems:

[Problem #1] How To Build Credibility With Potential Customers

[Problem #2] How To Obtain Testimonials Which Have Been Proven To Improve Sales

Fast Video Testimonials has been solving these two problems for hundreds of satisfied customers. Fast Video Testimonials has been tried and tested and known to produce excellent results.


First: Click Here For Fast Video Testimonials

Fast Video Testimonials always supplies REAL VIDEO TESTIMONIALS created specifically for your website and business.

Second: Order Your Video Testimonials Package of 1, 5 or 10 original Video Testimonials for your website.

Your new Video Testimonials will arrive within 7 days and all Video Testimonials are done by REAL PEOPLE and are guaranteed to boost your sales by up to 30%. Buy Video Testimonials today and boost your businesses online presence overnight.
The Biblical Calendar Outlawed: Constantine and the Council of Nicaea What Are Probiotics and How Can It Benefit You Silica And Quartz Crystal Facts Casablanca Ceiling Fans - Awesome Blend of Usability and Sophistication Roulette Methods - Can You Truly Make Funds Playing Roulette Art and Architecture in Barcelona Ayurveda and Mouth Care Meal Replacement Shakes - Benefits and Risks You Need to be Aware of Maintaining privacy and confidentiality is the important factor in choosing rehab Morehead City and Eastern North Carolina's Local Directory Getting Known To Mylar Sheets And Films Curtain Fabrics Trends - Linen and Cotton Fabrics Mylar Film And Its Use In Europonic System
print
www.yloan.com guest:  register | login | search IP(216.73.217.86) California / Rosemead Processed in 0.017699 second(s), 7 queries , Gzip enabled , discuz 5.5 through PHP 8.3.9 , debug code: 34 , 3155, 60,
Using Perl to Convert Hyperlinks and Filenames to Lowercase Rosemead