I have a module that will target several different operating systems
and configurations. Sometimes, some C code can make this module's task
a little easier, so I have some C functions that I would like to bind
the code. I don't have to bind the C functions -- I can't guarantee
that the end-user even has a C compiler, for instance, and it...
I have array which values are user input like:
aa df rrr5 4323 54 hjy 10 gj @fgf %d
Now I want to check each value in array to see whether it's numeric, alphabetic (a-zA-Z), or alphanumeric and save them in other respective arrays.
I have done:
my @num;
my @char;
my @alphanum;
my $str =<>;
my @temp = split(" ",$str);
fore...
I have two arrays, @a and @b. I want to do a compare among the elements of the two arrays.
my @a = qw"abc def efg ghy klm ghn";
my @b = qw"def ghy jgk lom com klm";
If any element matches then set a flag. Is there any simple way to do this?
...
I have used the following statements to get the current time.
print "$query executed successfully at ",localtime;
print "$query executed successfully at ",(localtime);
print "$query executed successfully at ".(localtime);
Output
executed successfully at 355516731103960
executed successfully at 355516731103960
executed succes...
Script pulls data from mysql:
$DBI::result = $db->prepare(qq{
SELECT close
FROM $table
WHERE day <= '$DATE'
ORDER BY day DESC
LIMIT $EMA
});
$DBI::result->execute();
while($row = $DBI::result->fetchrow) {
print "$row\n";
};
with the following example results:
1.560
1.560
1.550...
But I need to work out ...
I have an app running under Catalyst+FastCGI. And I want it to fork() to do some work in background.
I used this code for plain CGI long ago (and it worked):
defined(my $pid = fork) or die "Can't fork: $!";
if ($pid) {
# produce some response
exit 0;
}
die "Can't start a new session: $!" if setsid == -1;
close STDIN o...
I have an encrypted file X1, I have a Perl program P1 that decrypts the X1. I am parsing the decrypted file using a Perl program p2.
X1--P1(decrypter) --> X2(plain text file) --p2(parser) --> parse output
My parser is based on XML::Parser. It can work with a filehandle to the decrypted file. Now I am getting the X2 and storing it in t...
What are the disadvantages of the Tk module compared to other solutions to create a GUI in Perl?
...
I use use lib "./DIR" to grab a library from a folder elsewhere. However, it doesn't seem to work on my server, but it works fine on my local desktop.
Any particular reasons?
And one more question, does use lib get propagated within several modules?
Two situations:
Say I make a base class that requires a few libraries, but I know that...
I've .NET framework 3.5 installed in my laptop. Just .NET alone, no Visual Studio. How can I run Java, Python, Ruby and Perl programs from the console?
Do I need to install something else also, for running these language files?
In case there is a need for something extra to be installed and after i have all of them, what are the comma...
I'm finding it very convenient to pass configuration and other data that is read or calculated once but then used many times throughout a program by using Perl's use mechanism. I'm doing this by exporting a hash into the caller's namespace. For example:
package Myconfiguration;
my %config;
sub import {
my $callpkg = caller(0);
...
I have some data generated in MATLAB that I want to process using Perl. I saved the data from MATLAB in a .mat file. Is there any way to read it in Perl?
...
Specifically, I'm using the Linux command:
$ find . -regextype posix-extended -regex '<some regex>' ...
I just want to make sure the POSIX type I'm using is the type Perl uses, since that is by far the one I am most familiar with.
...
I am wondering if there are any tips or tricks to converting perl into python. It would be nice if there was a script like python's 2to3. Or perhaps some compatibility libraries. It doesn't have to be complete, anything to help speed up the process would be helpful.
...
I have a log file containing statistics from different servers. I am separating the statistics from this log file using regex only.
I am trying to capture the CPU usage from the running process. For SunOS, I have below output:
process,10050,user1,218,59,0,1271M,1260M,sleep,58.9H,0.02%,java
Here the CPU % is at 11th field if we separa...
When I'm running Devel::Cover with ModPerl::Registry, I get no coverage info except for BEGIN blocks. When I'm running the same script with Devel::Cover from command line or as a CGI, everything works alright (obviously).
How can I make Devel::Cover "see" my code being executed in the runtime?
Here's Devel::Cover related stuff in my ht...
I need a regular expression for validating the website URL using Perl.
...
Say I have a data file that I want to process; I want to take the maximum value of each of the column and append it to the end of each line.
INPUT:
T1 T2 T3
35.82 34.67 31.68
32.20 34.52 33.59
37.41 38.64 37.56
OUTPUT:
T1 T2 T3
35.82 34.67 31.68 35.82
32.20 34.52 33.59 34.52
37.41 38.64 37.56 38.64
I'm trying to implement this as ...
I am very new to Perl, so please bear with my simple question:
Here is the sample output:
Most successful agents in the Emarket climate are (in order of success):
1. agent10896761 ($-8008)
2. flightsandroomsonly ($-10102)
3. agent10479475hv ($-10663)
Most successful agents in the Emarket climate are (in order of succes...
I am a newbie to perl. My problem is...
I have a relative path
$base_path = input/myMock.TGZ
myMock.TGZ is the file name located in input folder.
The filename can change. But the path is always stored in $base_path.
I need to check if the file exists in $base_path.
Any suggestions are helpful to me
...