Here's the situation:
I've got two versions of a novel, both in txt format. One is in the original language and the other in Chinese or English translation.When reading the original version, it sometimes happens I want to take a quick look at the translated version of a particular sentence. What I expect is: a corresponding sentence fro...
I have several large files, each of which I want to chunk/split it in to
predefined number of parts.
Is there an efficient way to do it in Unix (e.g. via awk/sed/perl)?
Also each file can have varied number of lines.
File1.txt 20,300,055 lines
File2.txt 10,033,221 lines
etc...
...
G'day,
We have a Perl script that is processing geolocation requests from the head-end servers in a major web site. The script is a broker providing additional business logic interpreting the data returned by a COTS product that provides data for a given IP address, e.g. country, connection type, routing type, carrier, etc.
This Geo se...
I got involved in a new project where Perl is a must. I'm coming from a good Ruby foundation and want a quick introduction or mapping between Perl and Ruby as I heard that Perl and Ruby are very close in syntax (know nothing about features).
Do you have any recommendations for me?
What great Perl book do you recommend as an extended ...
Does anyone know what parsing or precedence decisions resulted in the warning 'Use of "shift" without parentheses is ambiguous' being issued for code like:
shift . 'some string';
# and not
(shift) . 'some string'; # or
shift() . 'some string';
Is this intentional to make certain syntactic constructs easier? Or is it merely an artif...
Hi all:
Seems like this should be obvious, but how do I send arrow key presses to a process using Expect.pm? Does it depend on the terminal type I am using (vt100) or do I send keyboard scancodes?
TIA.
...
I am writing small snippets in Perl and DBI (SQLite yay!)
I would like to log some specific queries to text files having the same filename as that of the table name(s) on which the query is run.
Here is the code I use to dump results to a text file :
sub dumpResultsToFile {
my ( $query ) = @_;
# Prepare and execute the query
...
Perl is warning me about using pseudo hashs in my program:
Pseudo-hashes are deprecated
How do I convert the following code so that is does not use pseudo hashs
foreach my $hash (@arrayOfHash) {
print keys %{$hash};
}
...
What syntax, if any, is able to take a reference of a builtin like shift?
$shift_ref = $your_magic_syntax_here;
The same way you could to a user defined sub:
sub test { ... }
$test_ref = \&test;
I've tried the following, which all don't work:
\&shift
\&CORE::shift
\&{'shift'}
\&{'CORE::shift'}
Your answer can include XS if need...
In some projects I've done in C, I've liked using the following macros which work similar to Perl's warn and die subroutines:
#include <stdio.h>
#include <stdlib.h>
#define warn(...) \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, " at %s line %d\n", __FILE__, __LINE__)
#define die(...) \
warn(__VA_ARGS__); \
exit(0x...
Okay, I've been struggling with this all weekend, and I've gotten plenty of help but I'm still not getting it. Here is my code so far: what I want to do is build a few matrices from user input. Eventually I want to multiply them. Another story.
input is as follows
1 2 2 4
4 5 6 6
1 2 2 3
1 2 2 3
sub makeMatrix {
my ($input) = @...
I have an existing website written is Perl and have recently added a WordPress blog and BBPress forums. Each of the three systems has its own login mechanism.
To make this a little cleaner I have integrated WordPress and BBPress to enable single sign-on between the two systems which works great. I now want to take the next step and int...
I'm having trouble getting a prepared statement in sqlite3 to work. I'm working with Perl and the Perl DBD framework. Below is the code I use:
#This is a function I have defined
sub query($@){
my $st = $db->prepare(shift);
$st->execute(@_);
}
#And it is used like so
query("UPDATE rooms SET name = ?, SET capacity = ? WHERE id = ...
I need to identify unfilled ovals in a PDF file. After that, I should fill them with color and I need coordinates of ovals with page numbers. Can anybody help me how to solve this using CAM::PDF?
...
We've got a mature body of code that loads data from files into a database.
There are several file formats; they are all fixed-width fields.
Part of the code uses the Perl unpack() function to read fields from the input data into package variables.
Business logic is then able to refer to these fields in a 'human-readable' way.
The file...
Hello! I am trying to cut down on the number of code lines I am using but am ending up with a fairly simple problem (although it's stumping me since I am just starting to wrap my head around references)
I am trying to concatenate several values in a particular order.. My code looks like this..
my $separator = ":";
my @vals = qw(name la...
This question is in continuation of this post, I have tried installing Xerces-C but the thing is Xerces-C version is 2.8.0 and 3.0.0 and XML::XERCES latest version is 2.7.0 and so am getting following error message:
Update2: Here is the error which am getting, it says there is somekind of version mismatch.
Using XERCES_LIB = /home/ad...
What is an expressive language?
What does it mean when someone says that Perl is an expressive language?
...
I know there are some very good Perl XML parsers like XML::Xerces, XML::Parser::Expat, XML::Simple, XML::RapidXML, XML::LibXML, XML::Liberal, etc.
Which XML parser would you select for parsing large files and on what parameter would you decide one over another? If the one you would like to select is not in list then please suggest it.
...
I am a beginner to Perl syntax and have a basic wildcard question. I am looking for an expression that would allow me to retrieve all of the following files.
/home/test-1.txt
/home/test-2.txt
/home/test-3.txt
I am just interested in the actual wildcard expression, not the file I/O.
...