Help Perlers! Does anyone know a simple "insert code here" approach would bring code from external files once at compile time into a package?
Background:
I have a standard PBP-style inside-out class that is getting quite large. I want to split the code into multiple files but not extend the class. Optimally, I would simply insert th...
Is there a online/cloud-ish app engine with an available Perl option?
I'd like to write and deploy a personal web app that's hosted by some existing web App engine (the app's fairly simple and resource-cheap, but does need small online storage. If anyone cares, it's basically a family-scope shopping list to be used off of smartphones an...
Background: 19th-century German archeologist Heinrich Schliemann was of course famous for his successful quest to find and excavate the city of Troy (an actual archeological site for the Troy of Homer's Iliad).
However, he is just as famous for being an astonishing learner of languages - within the space of two years, he taught himself...
I'm still trying to sort out my hash dereferencing. My current problem is I am now passing a hashref to a sub, and I want to dereference it within that sub. But I'm not finding the correct method/syntax to do it. Within the sub, I want to iterate the hash keys, but the syntax for a hashref is not the same as a hash, which I know how t...
I am an experienced Perl developer with some degree of experience and/or familiarity with other languages (working experience with C/C++, school experience with Java and Scheme, and passing familiarity with many others).
I might need to get some web work done in Python (most immediately, related to Google App Engine). As such, I'd like ...
I'm using DBI to query a SQLite3 database. What I have works, but it doesn't return the columns in order. Example:
Query: select col1, col2, col3, col4 from some_view;
Output:
col3, col2, col1, col4
3, 2, 1, 4
3, 2, 1, 4
3, 2, 1, 4
3, 2, 1, 4
...
(values and columns are just for illustration)
I know this i...
I am trying to install HTML-Parser-3.64 and I get following report while running make test:
ERL_DL_NONLAZY=1 /home/Perl/bin/perl -Iblib/arch -Iblib/lib -I/home/Perl/5.6.1-nothread/lib/perl5/5.6.1/sun4.SVR4 -I/home/Perl/5.6.1-nothread/lib/perl5/5.6.1 -e 'use Test::Harness qw( $verbose=0; runtests @ARGV;' t/*.t
t/api_version........ok ...
I'm trying to capture the last digits in this line in a regex group:
The input:
9 Power_On_Hours 0x0032 099 099 000 Old_age Always - 54654
My pattern:
/Power_On_Hours.+Always\s.+([0-9]{1,5})/
I just can't seem to get it to capture "54654", it's returning undef :(
...
I am pretty new to regular expressions. I want to write a regular expression which validates whether the given string has only certain characters. If the string has any other characters than these it should not be matched.
The characters I want are:
& ' : , / - ( ) . # " ; A-Z a-z 0-9
...
How can I include a variable in a printf expression?
Here's my example:
printf "%${cols}s", $_;
Where $cols is the number of columns
and $_ is a string.
The statement results in an "Invalid conversion" warning.
The problem ended up being that I forgot to chomp the variable. Gah. Thanks everyone.
...
I created a server with Perl under Windows (ActivePerl 5.10.1 build 1006) that forks upon being connected to, accepts some JSON data, and writes it to a database. I am running into a problem after 64 clients connect to the server, the error message being "Resource is not available" when trying to fork.
Running this code under Linux I f...
Hello
I am looking for a method to insert random XML data in Java (or Perl).
<vehicles ID="DJ3RKFF9">
<vehicle>
<make>Toyota</make>
<model>Yaris</model>
<year>2009</year>
</vehicle>
<vehicle>
<make>Ford</make>
<model>Taurus</model>
<year>2008</year>
</vehicle>
</vehicles>
...
I'm looking through perlop and perlsub pages of the Perl manual. There are many references about "magic" and "magical" here (just search any of them for the "magic"). I wonder why is Perl so rich in them.
Some examples:
print ++($foo = 'zz') # prints 'aaa'
printf "%d: %s", $! = 1, $! # prints '1: Operation n...
Recently programming in PHP, I thought I had a working Perl regular expression but when I checked it against what I wanted, it didn't work.
What is the right expression to check if something is a MD5 has (32 digit hexadecimal of a-z and 0-9).
Currently, I have /^[a-z0-9]{32}$/i
...
In a Perl script (with Ubuntu) I'd like to do something like
use Blah;
...
...
my $response =
&Blah::Fetch($URL, {'method'=>'POST', 'parameters' => \%params});
which I've written for convenience to look a lot like a Prototype.js ajax call, but obviously we're using Perl not Javascript, we're on a server not a ...
I’d like to write a Perl one-liner to decode a line of ASCII characters encoded as hexadecimal numbers (for example the line 48 54 54 50 should be decoded as HTTP). I came up with this:
perl -nE 'say map(chr, map { qq/0x$_/ } split)'
It prints an empty line. What am I doing wrong and how would you write it?
...
Possible Duplicate:
What does select((select(s),$|=1)[0]) do in Perl?
What's the purpose of the second line ?
open my $fh, '>>', $logfile or die $!;
select((select($fh), $|=1)[0]);
...
I am trying to run a Perl program in Java.
I'm using:
process = Runtime.getRuntime().exec("getComps.pl");
but it is giving:
Exception: java.io.IOException: Cannot
run program "getComps.pl":
CreateProcess error=193, %1 is not a
valid Win32 application
I have also tried:
process = Runtime.getRuntime().exec("cmd /c start ge...
Hi:)
I have a hindi script file like this:
3. भारत का इतिहास काफी समृद्ध एवं विस्तृत है।
I have to write a program which adds a position to each and every word in each sentence.
Thus the numbering for every line for a particular word position should start off with 1 in parentheses. The output should be something like this.
3. भारत...
I have a file with the below contents:
After learning everything you've learned so far,
you may think you've bingo: got a pretty good foundation in
programming Perl, since you'd already be a good way
through most of the concepts many other languages entail.
endbingo: But if you put down
this book today and did nothing else
bingo: ...