I need to run Perl applications I develop on cygwin Windows on HP unix / Solaris hosts. I am not a superuser on the unix machines and I can't touch the default Perl module location nor can I install modules to the default Perl module location. Also the unix installation lacks most basic modules and I can't change that.
For example, I ha...
Previously, this function worked for me...
$this_day = Day_of_Week($lyear, $month, $day);
using this lib..
use Date::Calc qw(Add_Delta_Days Day_of_Week Delta_Days);
But I need another way to get this same info.
the error it returned is
Date::Calc::Day_of_Week(): not a valid date
Any ideas?
...
This question is similar to "dropping trailing ‘.0’ from floats", but for Perl and with a maximum number of digits after the decimal.
I'm looking for a way to convert numbers to string format, dropping any redundant '0', including not just right after the decimal. And still with a maximum number of digital, e.g. 3
The input data is fl...
How can I use bash syntax in Perl's system() command?
I have a command that is bash-specific, e.g. the following, which uses bash's process substitution:
diff <(ls -l) <(ls -al)
I would like to call it from Perl, using
system("diff <(ls -l) <(ls -al)")
but it gives me an error because it's using sh instead of bash to execute th...
How do I know what modules are distributed with Perl?
My first guess is that the core modules listed here are always included, though I cannot find this stated explicitly. However, I have used modules outside this set (e.g. LWP) without having to install them on Mac OS X and Linux.
So to refine my question a little:
What modules are...
I need to serve a large file (500+ MB) for download from a location that is not accessible to the web server. I found the question Serving large files with PHP, which is identical to my situation, but I'm using Perl instead of PHP.
I tried simply printing the file line by line, but this does not cause the browser to prompt for download...
Is there a way to make Perl's Template display warnings for all undefined values that I attempt to use the GET directive on (via [% %]) during Template::process?
The default behavior is to ignore and move on. I'd like to warn only in the case of undefined values, if possible, and to log messages to STDERR.
...
Hi! I'm creating a ladder system for some games and I've encountered a problem regarding the clan base system. You see, every player who joins are parsed and put into a players table. Like this:
chelsea | gordon
chelsea | jim
chelsea | brad
OR...
CLANTAG|> jenna
CLANTAG|> jackson
CLANTAG|> irene
So, what I want: I wanna grab the C...
I have inherited a broad, ill-designed web portfolio at my job. Most pages are written in Perl as most of the data ingested, processed, and displayed on the site comes in the form of flat-files which then have to be meticulously regexed and databased in our MySQL and Oracle databases.
As the first IT-trained manager of this environme...
hi
Is there a way to extract HTML page title using Perl? I know it can be passed as a hidden variable during form submit and then retrieved in Perl that way but I was wondering if there is a way to do this without the submit?
Like, lets say i have an HTML page like this:
<html><head><title>TEST</title></head></html>
and then in Per...
Given a string like this:
<a href="http://blah.com/foo/blah">This is the foo link</a>
... and a search string like "foo", I would like to highlight all occurrences of "foo" in the text of the HTML -- but not inside a tag. In other words, I want to get this:
<a href="http://blah.com/foo/blah">This is the <b>foo</b> link</a>
Ho...
Does anyone know of a good Perl unit test generator?
...
I'm modifying a pre-existing script in Xcode to customize my file headers. The script is Perl and it's not my best langage. :)
I just need to insert the current date in the header in dd/mm/yy format.
Here is my script :
#! /usr/bin/perl -w
# Insert HeaderDoc comment for a header
#
# Inserts a template HeaderDoc comment for the header....
In Perl both grep and map take an expression and a list, and evaluate the expression for each element of the list.
What is the difference between the two?
...
I have the following set of constraints in Perl (just a sample set of constraints, not the ones I really need):
$a < $b
$b > $c
$a is odd => $a in [10..18]
$a > 0
$c < 30
And I need to find a list ($a, $b, $c) that meet the constraints. My naive solution is
sub check_constraint {
my ($a, $b, $c) = @_;
if !($a < $b) {return 0...
I'm trying to monkey patch a Perl class: I want to change the behavior of an existing method.
This node on perlmonks shows how to add a function to an existing class. I found that this pattern can also be used to provide a new implementation for an existing function.
However, I'd like to know how to call the original function.
I'm lo...
Here's a quick Perl question:
How can I convert HTML special characters like ü or ' to normal ASCII text?
I started with something like this:
s/\&#(\d+);/chr($1)/eg;
and could write it for all HTML characters, but some function like this probably already exists?
Note that I don't need a full HTML->Text converter. I alrea...
Hi,
I'm using a Perl program to extract text from a file. I have an array of strings which I use as delimiters for the text, e.g:
$pat = $arr[1] . '(.*?)' . $arr[2];
if( $src =~ /$pat/ ) {
print $1;
}
However two of the strings in the array are '$450' and '(Buy now)'. The problem is that the symbols in the strings represent en...
I am getting data from a database. It has 4 rows and 6 columns. I want to show this in an HTML table but am having problems. I've made the TH for the 6 columns. However, I am having problems in displaying the 4 rows. This is what I have so far:
while (($f1, $t2, $n3, $k4, $d5, $e6) = $sth1->fetchrow_array)
{
push (@first, $f...
I am running a query 'describe table' and it returns value of 'null' for the 'default' column. However, when I try to print the value from database to an HTML table it is not printing 'null'. It is just always blank.
This is how I am storing the data from database:
@nulls = ();
while (($null) = $sth1->fetchrow_array)
{
push...