comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
February 2008
motuwethfrsasuw
    123 5
45678910 6
11121314151617 7
18192021222324 8
2526272829   9
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  FAQ 4.35 How do I find the soundex value of a string?         


Author: PerlFAQ Server
Date: Feb 23, 2008 18:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.35: How do I find the soundex value of a string?

(contributed by brian d foy)

You can use the Text::Soundex module. If you want to do fuzzy or close
matching, you might also try the "String::Approx", and
"Text::Metaphone", and "Text::DoubleMetaphone" modules.

--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.
Show full article (1.25Kb)
no comments
  uc() and utf8         


Author: Petr Vileta
Date: Feb 23, 2008 18:02

I have some data in file coded in windows-1250 (cp1250). My script is written
in utf-8 codepage and run on perl 5.8.x. I need to convert some strings to
uppercase but uc() fail. What is the right way?

This example illustrate a problem.

#!/usr/bin/perl
use strict;
use utf8;
use Unicode::Lite;

print "Content-Type: text/html\n\n\n",
"",
"\n";

# string in cp1250 codepage
my $wintxt="\xec\x9a\xe8\xf8\x9e\xfd\xe1\xed\xe9";

# convert to utf8
my $utftxt=convert('CP1250','UTF8',$wintxt);

print "
Win: $wintxt, ",uc($wintxt),"
utf8:$utftxt, ",uc($utftxt),"\n";
print "\n";
Show full article (0.90Kb)
9 Comments
  CPAN and man page installation         


Author:
Date: Feb 23, 2008 17:28

With the cpan utility, what configuration option need to be modified
to install the man pages of modules at some place?

Installation currently fails with the following error:

mkdir /usr/local/man/man3: Permission denied at /usr/share/perl/5.8/ExtUtils/Install.pm line 112

So, I need to tell cpan to install the man pages in ~/man/man1
and ~/man/man3.

--
Vincent Lefèvre vinc17.org> - Web: <http://www.vinc17.org/>
100%% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
3 Comments
  files, xml and xds; examples of for practice         


Author: mk834tt
Date: Feb 23, 2008 15:28

I'm diving into xml with "XML and Perl", a New Riders book published
in 2003(?). This "old" book has links to obtain sample files for use
in the examples. Well, the links are gone or useless now. Where can
I find some good xml and xml schema files for use in these exercises?
Modifying the code is easier than typing in some of these large
files..

Thank you.
no comments
  PL/Perl: when to set @INC?         


Author: kj
Date: Feb 23, 2008 14:12

This is a question about PL/Perl, PostgreSQL's Perl procedural
language.

I have a database where I want to make heavy use of PL/Perl stored
procedures. Also, I'd like these procedures to be able to load
Perl modules that reside outside the paths in the default @INC, so
I'd like to modify @INC appropriately as soon as possible after
the PostgreSQL server is started.

Does anyone know how to do this?

TIA!

Kynn

--
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.
2 Comments
  Re: new variable stupidity         


Author: Tad J McClellan
Date: Feb 23, 2008 12:55

Time Waster wrote:
> OK, i'm being lazy to ask here. :(
>
> I'm always finding myself doing this:
> $newvar = $oldvar;
> $newvar = s/something/else/;
> ..because i want both of them. Is there a way to do this in 1 statement?

(my $newvar = $oldvar) =~ s/something/else/;

--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
2 Comments
  new variable stupidity         


Author: Time Waster
Date: Feb 23, 2008 12:46

OK, i'm being lazy to ask here. :(

I'm always finding myself doing this:
$newvar = $oldvar;
$newvar = s/something/else/;
..because i want both of them. Is there a way to do this in 1 statement?
no comments
  FAQ 4.13 How do I find the current century or millennium?         


Author: PerlFAQ Server
Date: Feb 23, 2008 12:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.13: How do I find the current century or millennium?

Use the following simple functions:

sub get_century {
return int((((localtime(shift || time))[5] + 1999))/100);
}

sub get_millennium {
return 1+int((((localtime(shift || time))[5] + 1899))/1000);
}

On some systems, the "POSIX" module's "strftime()" function has been
extended in a non-standard way to use a %%C format, which they sometimes
claim is the "century". It isn't, because on most such systems, this is
only the first two digits of the four-digit year, and thus cannot be
used to reliably determine the current century or millennium.
Show full article (1.71Kb)
no comments
  FAQ 4.26 How do I reformat a paragraph?         


Author: PerlFAQ Server
Date: Feb 23, 2008 06:03

This is an excerpt from the latest version perlfaq4.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

4.26: How do I reformat a paragraph?

Use "Text::Wrap" (part of the standard Perl distribution):

use Text::Wrap;
print wrap("\t", ' ', @paragraphs);

The paragraphs you give to "Text::Wrap" should not contain embedded
newlines. "Text::Wrap" doesn't justify the lines (flush-right).

Or use the CPAN module "Text::Autoformat". Formatting files can be
easily done by making a shell alias, like so:

alias fmt="perl -i -MText::Autoformat -n0777 \
-e 'print autoformat $_, {all=>1}' $*"

See the documentation for "Text::Autoformat" to appreciate its many
capabilities.

--------------------------------------------------------------------
Show full article (1.63Kb)
no comments
  Form submit with mechanize 0.72         


Author: Cashbackre
Date: Feb 23, 2008 05:38

I am currently using mechanize 0.72 on active perl 5.8.6 for some
strange reason I cannot upgrade to the current version
of 1.34 so this is not an option, the problem is I am trying to submit
my login details on a page with two forms
with the same name but different values, I am trying to submit to the
second form with relevant form html:
,
I understand mechanize 1.34 has a click_button function, whereby I can
click by value, however 0.72 does not have the click_button function,
I can fill in my username and password, and check that they have been
filled in correctly but every submission of the form either via
$mech->click("submit");
or $mech->submit();
or $mech->submit("submit");
ends up submitting the very first form
1 Comment
1 2