I have some data from a database (SQLite), mapping a value (an integer) to a date. A date is a string with this format: YYYY-MM-DD hh:mm. The dates are not uniformly distributed. I want do draw a line graph with the dates on X and the values on Y. What is the easiest way to do this with Perl?
I tried DBIx::Chart but I could not make it ...
I'm trying to run a perl script from within a bash script (I'll change this design later on, but for now, bear with me). The bash script receives the argument that it will run. The argument to the script is as follows:
test.sh "myscript.pl -g \"Some Example\" -n 1 -p 45"
within the bash script, I simple run the argument that was passe...
I am struggling through objects in perl, and am trying to create a 2d array and store it in a hash field of my object. I understand that to create a 2d array I need an array of references to arrays, but when I try to do it I get this error: Type of arg 1 to push must be array (not hash element) The constructor works fine, and set_seqs wo...
How can I convert a string to a regular expression that matches itself in Perl?
I have a set of strings like these:
Enter your selection:
Enter Code (Navigate, Abandon, Copy, Exit, ?):
and I want to convert them to regular expressions sop I can match something else against them. In most cases the string is the same as the regular exp...
Hello,
I learning Perl and I want to create a simple application that gets all my emails and save they to a file, but how I can do this? Thanks.
...
What does the underscore mean in the following regex?
[a-zA-Z0-9_]
The _ seems to make no difference so I don't understand the purpose of it.
...
Hello,
I learning Perl and doing a home made project to my family (a subscription project). The Perl application that uses Net::POP3 connect to my mailbox and save all my emails to a file (Mail.txt). When I open this file I see a lot of junk, as below. What i can do to remove this? Thanks.
Return-Path:
Received: from [unix socket] by...
I want to validate a condition before doing the next step, but only raise a warning and skip the current value instead of die-ing.
How do I rewrite validate_me() subroutine without returning any value?
(Update) please note that the following code works as expected, it just that I want something else instead of returning 1 or 0 from val...
I've got a piece of code that works fine. It basically loops through each element of a hash using foreach() and applies a transformation to it using a regular expression, like so :
foreach my $key ( keys( %{$results} ) ) {
$results->{$key}{uri} =~ s/\".*\/(.*\.*(gif|jpe?g|png))\"/\/resources\/uploads\/$1/gi;
}
$results is a hashref...
Hi All,
I have a perl script running in a aix box.
The script tries to open a file from a certain directory and it fails to read the file because file has no read permission.
but i get a different error saying "inappropriate ioctl for device"
Shouldn't it say something like file doesn't have read permission or something?
What does t...
I'm teaching myself Perl and I learn best by example. As such, I'm studying a simple Perl script that scrapes a specific blog and have found myself confused about a couple of the regex statements. The script looks for the following chunks of html:
<dt><a name="2004-10-25"><strong>October 25th</strong></a></dt>
<dd>
<p>
[Cont...
Hi, I am a newbie when it comes to gVim, Perl & test scripts, so I hope this is not a stupid question?
I have successfully installed Perl::Tags 0.26 under Linux and OS X but am getting installation test errors under WIN32 -- also see perl.cpan.testers
My questions are:
(i) Does VIM need Perl::Tags or can I rely on exuberant ctags to g...
I am using tab completion support of Term::ReadLine::Gnu module. Every time I do a tab, I get a space after the completed word.
For example:
If i have a word "complete" as a possible completion. After prompt I pressed tab and I am
getting it like:
"complete "
where these is a space at the end of the completed word. What I want is:
...
I'm trying to learn how to profile perl memory.
I have a very simple Perl hello-world script and I want to know its size in memory.
I use GTop utility to measure the memory (recommended in mod_perl book by Stas Beckman).
GTop provides the results that confuse me.
When I run the script from the command line GTop says: 7M.
When I run i...
I have some text I want to linkify, which I can reasonably do with a regex (search for http/https or www) but I'm worried about XSS complications. What's a safe way to do this in Perl?
...
I would like to use Log4perl in a project but disable it for a certain class (which is, in this case Net::Amazon). I thought this would be an easy one, but somehow I failed.
I tried using
use Log::Log4perl (:easy_init);
use Net::Amazon;
my $amz = Net::Amazon->new( ... );
my $log = Log::Log4perl->easy_init($DEBUG);
$log = $log->get_log...
Apache version 2.2.11 (Unix)
Architecture x86_64
Operating system Linux
Kernel version 2.6.18-164.el5
Ok, here is what I have working. However, I may not be using File::Util for anything else in the rest of the script.
My directory names are 8 digits starting at 10000000 .
I was comparing the highest found number with stat last create...
Edited
Now my code is like this:
#!/usr/bin/perl
# import packages
use Net::POP3;
use Getopt::Long;
use Mail::Message;
use strict;
use warnings;
# read command line options
# display usage message in case of error
GetOptions ('h|host=s' => \$host,
'u|user=s' => \$user,
'p|pass=s' => \$pass) or die("Input error...
Hello all,
I'm looking at 'pygoogle' python library for google search, call from my python script. But google doesn't give out license key anymore, and looks like pygoogle needs license key to work.
Does anyone have suggestions of libraries to use for scripting web searches? Languages doesn't matter. It can be in python, perl, lisp, fo...
I am trying to collect the values from command line using Getopt::Std in my Perl script.
use Getopt::Std;
$Getopt::Std::STANDARD_HELP_VERSION = 1;
getopts('i:o:p:');
my $inputfile = our $opt_i;
my $outputfile = our $opt_o;
my $parameter_value = our $opt_p;
Here the first two variables ($inputfile,$outputfile) are mandatory but the las...