What is the preferred way to insert strings that can contain both single and double quotes (",') into MySql using DBI? For example, $val1 and $val2 can contain quotes:
my $dbh = DBI->connect( ... );
my $sql = "insert into tbl_name(col_one,col_two) values($val1, $val2)";
my $sth = $dbh->prepare($sql);
$sth->execute();
...
I have to sort a number of integers, which can have values between 30.000.000 and 350.000.000. There will be between 0 and 65.535 integers, with the average count being 20.000. RAM usage is irrelevant and speed only is important.
Later on i will also have to split them into groups, with the divide always being set whenever the gap betwe...
I want to do the inverse of sort(1) : randomize every line of stdin to stdout in Perl.
...
What's the best method for benchmarking the performance of my various templates when using Template::Toolkit?
I want something that will break down how much cpu/system time is spent processing each block or template file, exclusive of the time spent processing other templates within. Devel::DProf, for example, is useless for this, sin...
How would I convert a string holding a number into an integer in Perl?
...
Is it possible to perform a named-group match in Perl's regex syntax as with Python's? I always bind the $n values to proper names after matching, so I'd find it more convenient to do it in the regex itself if it's possible.
Python does it like so:
>>> import re
>>> regex = re.compile(r'(?P<count>\d+)')
>>> match = regex.match('42')
>>...
Our website uses Perl to provide a simple mechanism for our HR people to post vacancies to our website. It was developed by a third party, but they have been long since kicked into touch, and sadly we do not have any Perl skills in-house. This is what happens when Marketing people circumvent their in-house IT team!
I need to make a simp...
A few years ago I did a lot of work with CGI.pm. I'm evaluating using it again for a quick project. Can someone bring me up to speed on the current state of developing with CGI.pm in the "Web 2.0" world? What are the best libraries on CPAN to use with it? Are there clean ways to include jQuery, YUI, other CSS libs, etc, and do some A...
I'm having a hard time determining what characters must be escaped when using Perl's qr{} construct
I'm attempting to create a multi-line precompiled regex for text that contains a myriad of normally escaped characters (#*.>:[]) and also contains another precompiled regex. Additionally I need to match as strictly as possible for testing...
I need to do some quick-and-dirty Perl GUI building. I can't afford a Komodo License.
What would people recommend as a free (as in beer) alternative. I don't care if it is UNIX or Windows or both. I would be using either Win32 Perl or Perl/Tk depending on what has the best solution. I would also look at any PM's that use something else. ...
I am making some plots in Perl using GD::Graph and some of the data is outside the area I would like to display, but instead of being truncated off the chart outside the graphing area, it is being drawn over the title, legend, and axis labels. Does anyone know how to stop this from happening?
...
Hello Perl, DBD, and Oracle Masters:
I have a Perl web application that is behaving oddly. I am using it to read some stuff from an Oracle DB and report. I have version 11.1.0.6.0 of Oracle's Instant Client installed. I'm running on WinXP and have the PATH environment variable set to the instant client location. I have Apache2 for my...
I am using ActiveState Perl 5.6 on a Windows 2003 Server, and am having some memory leak issues. Are there any good tools (or even bad tools which would give a clue) which I would be able to use to help find them.
...
I'm looking for a module or some way to obtain the information of the content of a file.
The same that the linux "file" command does, but in Perl language.
Thanks.
...
In Perl
print "a" x 3; # aaa
In C#
Console.WriteLine( ??? )
...
Why does this leak in Perl ?
$ perl -MDevel::LeakTrace::Fast -e 'our @a=(1);our @b=(1)'
leaked SV(0x0x84e053c) from -e line 1
$ perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi
[...]
$ uname -a
Linux ant1 2.4.21-20.ELsmp #1 SMP Wed Aug 18 20:46:40 EDT 2004 i686 i686 i386 GNU/Linux
Thanks!
...
I have a directory full of files and I need to pull the headers and footers off of them. They are all variable length so using head or tail isn't going to work. Each file does have a line I can search for, but I don't want to include the line in the results.
It's usually
*** Start (more text here)
And ends with
*** Finish (more te...
Is there a quick-and-dirty way to tell programmatically, in shell script or in Perl, whether a path is located on a remote filesystem (nfs or the like) or a local one? Or is the only way to do this to parse /etc/fstab and check the filesystem type?
...
I'd love to know if there is a module to parse "human formatted" dates in Perl. I mean things like "tomorrow", "Tuesday", "next week", "1 hour ago".
My research with CPAN suggest that there is no such module, so how would you go about creating one? NLP is way over the top for this.
...
what could this line possibly mean?
my $x = shift ;
...