I'm trying to tackle a problem by using a SQLite database and Perl modules. In the end, there will be tens of millions of entries I need to log. The only unique identifier for each item is a text string for the URL. I'm thinking of doing this in two ways:
Way #1: Have a good table, bad table, unsorted table. (I need to check the html an...
I have some subroutines that I call like this myWrite($fileName, \@data). myWrite() opens the file and writes out the data in some way. I want to modify myWrite so that I can call it as above or with a filehandle as the first argument. (The main reason for this modification is to delegate the opening of the file to the calling script ...
I've got a string that contains multiple substrings, each of which contains one or more 'E' character. I am trying to get the coordinates of each of these sustrings using Perl and regex. Here is what I tried at first.
#!/usr/bin/perl
use strict;
my $str = "GGGFFEEIIEIIIIEEEIIIETTGGG";
foreach my $match($str =~ m/(E+)/)
{
print "match...
Greetings,
I've taken over from a prior team and writing ETL jobs which process csv files. I use a combination of shell scripts and perl on ubuntu. The csv files are huge; they arrive as zipped archives. Unzipped, many are more than 30Gb - yes, that's a G
Legacy process is a batch job running on cron that unzips each file entirely, rea...
I have a terrible nested script structure I am maintaining that takes user input from the keyboard periodically and I am trying to write a script that will automate this input. Essentially, the script structure looks like this:
cmd1.csh takes 3 lines of input and
then calls cmd2.csh, then exits
normally
cmd2.csh calls cmd3.pl twice
an...
I am generating relatively large files using Perl. The files I am generating are of two kinds:
Table files, i.e. textual files I print line by line (row by row), which contain mainly numbers. A typical line looks like:
126891 126991 14545 12
Serialized objects I create then store into a file using Storable::nstore. These objects usual...
I would like to completely reset my %hash so that it does not contain keys or values at all. I prefer to use a one-liner than have to use a loop.
So far I have tried:
%hash = 0;
%hash = undef;
But these both throw errors in strict mode with warnings enabled, so I wrote a simple for loop to achieve the same thing:
for (keys %hash) {
...
Hi there! I have a log file which needs to be properly formatted into a readable format. However the text file has no static number of lines or fixed primary values and has random number of spaces but has only a log file header which can be used to pin point the start and end of each time the application logs.
An Example of the log file...
I have a function written in C (Say in HelloWorld.c file).
I want to compile this and need to create a staic object file HelloWorld.a
Finally I need to call this from a Perl program (HelloWorld.pl).
...
I'm new to Perl and I want to open a Word document in the MS Word application with cursor pointing the location specified by me. Is it possible to implement this requirement in Perl?
...
I want match
my @array = ( 'Tree' , 'JoeTree','Joe');
foreach (@array ) {
if ( $_ =~ /^(Joe)[^Tree]/gi) {
print "matched $_";
}
}
It matching only Joe. it should not matching anything else
...
How do I benchmark (compare two different implementations) and profile (find performance bottlenecks in an implementation) behavior of a web application (in Perl) under heavy load? This webapp is (supposedly) IO bound rather than CPU bound.
I'd like to compare proposed implementation (proposed improvement) with current solution, either...
How do I color text in Perl's standard output without using any extra module?
...
I need to build a test bench by sending appropriate inputs to an application. However,
once I launch the application, it takes control and does not return to the command
prompt (unless an exit command is executed from the application). In that case
is there any technique by which I can send a command to that application from the Perl
scr...
So far it submits the email but no matter what I do it will not redirect (server errors) and I need to redirect it to a custom error page.
How would I modify this to make it work?
Original code:
# If any error fields have been found, send error message to the user. #
if (@error) { &error('missing_fields', @error) }
new code:
...
I have a zip file X and I'd like do extract a single file, located in x/x/x/file.txt. How do I do this using Archive::Zip and Perl?
...
I have the following Perl script counting the number of Fs and Ts in a string:
my $str = "GGGFFEEIIEETTGGG";
my $ft_count = 0;
$ft_count++ while($str =~ m/[FT]/g);
print "$ft_count\n";
Is there a more concise way to get the count (in other words, to combine line 2 and 3)?
...
I am trying to figure out which module in my CGI::Application is loading Moose. I attempted to overload "require" but I don't seem to have the syntax quite right. If someone could clean up the following code I would appreciate it:
use strict;
use warnings;
use Carp qw//;
BEGIN {
*CORE::GLOBAL::require = sub (*) {
warn "Requiring...
I've got a large number of PHP files and lines that need to be altered from a standard
echo "string goes here"; syntax to:
custom_echo("string goes here");
This is the line I'm trying to punch into Perl to accomplish this:
perl -pi -e 's/echo \Q(.?*)\E;/custom_echo($1);/g' test.php
Unfortunately, I'm making some minor syntax error, an...
I have been told that disabling backreferences in perl improves performance (provided you're not using them), and that if you don't use any backreferences perl will do this by itself.
Now I have a perl script with a large number of regex in it and only a single one uses a backreference and I would like to know the following:
Given I h...