Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Our scripts take the category name and class title name from the database and use that to name those html pages and as the name of the link to those pages. We would need to look at removing the apostrophe during these steps of file creation and link creation in order to get working. The browser cannot process a link to a file with an apostrophe, thus the NOT FOUND message We need to find out what it would take to do this. What the specific limitations are, what's possible, etc. with the existing Perl scripting. If necessary, look at other options. Perl can handle apostrophes. The solution may be having the apostrophes in the text that the person sees, but not in the actual hyperlink reference/file name. Please reply meback the solution. Thanks, Dora
  • Comment on Perl to show up ' in the tile using perl script for more than 100 titles which should have a ' in the titles

Replies are listed 'Best First'.
Re: Perl to show up ' in the tile using perl script for more than 100 titles which should have a ' in the titles
by chromatic (Archbishop) on Apr 12, 2001 at 02:56 UTC
    Would it be possible to use the encode() method of the CGI module to translate the apostrophe into a URL-allowed character? The URI module?
Re: Perl to show up ' in the tile using perl script for more than 100 titles which should have a ' in the titles
by Desdinova (Friar) on Apr 12, 2001 at 03:01 UTC
    You should be able to do this using a simple tr construct to remove the apostrophe from the name. This snippet shows the idea it replaces the apostrophe with an underscore char.
    #!/usr/bin/perl -w use strict; my $test = 'Bill\'s Class'; print "$test\n"; $test =~ tr/\'/_/; # this does the work print "$test \n";