I've seen some jobs around that revolve around converting Perl scripts to Java. What are the benefits of this?
I am not looking for job benefit reasons. I am trying to find out business\technical reasons they would have behind this. Is Java easier to maintain than Perl scripts?
...
Hello! I've found in a Module a for-loop written like this
for( @array ) {
my $scalar = $_;
...
...
}
Is there Difference between this and the following way of writing a for-loop?
for my $scalar ( @array ) {
...
...
}
...
I frequently use the following pattern to set an upper bound to the running time of a particular code fragment in Perl:
my $TIMEOUT_IN_SECONDS = 5;
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm($TIMEOUT_IN_SECONDS);
# do stuff that might timeout.
alarm(0);
};
if ($@) {
# handle timeout condition.
}
My ques...
Part of my code goes like this:
while(1){
my $winmm = new Win32::MediaPlayer;
$winmm->load('1.mp3'); $winmm->play; $winmm->volume(100);
Do Some Stuff;
last if some condition is met;
}
Problem is: I want the music to be always on when I'm in the Do Some Stuff stage in the while loop. But the lengt...
Hi...:) This might look to be a very long question to you I understand, but trust me on this its not long. I am not able to identify why after processing this text is not being able to be read and edited. I tried using the ord() function in python to check if the text contains any Unicode characters( non ascii characters) apart from the ...
How do you translate this perl subroutine into a PHP function?
sub disagreement {
my $disagreement = 0;
my %aggregate = () ;
foreach my $item (@_) {$aggregate{$item}++}
foreach my $cat_a (keys %aggregate) {
foreach my $cat_b (keys %aggregate) {
if ($cat_a != $cat_b) {$disagreement += $aggregate{$cat_a} * $aggregate{$ca...
What I need is something like this:
/<[\w\d]+ ([\w\d]+\=[w\d])+\/>/
Something that would match several attribute key/value pairs. Is that possible?
...
I'm getting my feet wet in DBIx::Class loving it so far.
One problem I am running into is that I want to query records, filtering out records that aren't in a certain date range.
It took me a while to find out how to do a <= type of match instead of an equality match:
my $start_criteria = ">= $start_date";
my $end_criteria = "<= $end...
I have a hex string (length 48 chars) that I want to convert to raw bytes with the pack function in order to put it in a Win32 vector of bytes.
How I can do this with Perl?
...
Is there a way for DBI to connect to a RedBrick database? I don't see a driver anywhere, and there is very little discussion of this.
Thanks
...
I have a script that uses Parallel::ForkManager. However, the wait_all_children() process takes incredibly long time even after all child-processes are completed. The way I know is by printing out some timestamps (see below). Does anyone have any idea what might be causing this (I have 16 CPU cores on my machine)?
my $pm = Parallel::For...
I'm writing a perl program that was doing a simple get command to retrieve results and process them. But the site has been updated and now has a java component that handles the results (so the actual data is not in the source code anymore).
This is the site:
http://wro.westchesterclerk.com/legalsearch.aspx
Try putting in:
Index Numbe...
While trying to profile my Perl program, I find that Math::Complex is taking up a lot of time with what looks like some kind of warning.
Also, my code shouldn't have any complex numbers being generated or used, so I am not sure what it is doing in Math::Complex, anyway. Here's the FastProf output for the most expensive lines:
/usr/lib...
I'm having trouble translating a subroutine from Perl to PHP (I'm new to Perl).
The entire subroutine is as follows:
sub find_all_subsets {
if (1 == scalar (@_)) {return [@_]}
else {
my @all_subsets = () ;
my $last_item = pop (@_) ;
my @first_subsets = find_all_subsets (@_) ;
foreach my $subset (@first_subsets) {
...
Examples:
%hash = (2010 => 21, 2009=> 9);
$hash = {
a => {
0 => {test => 1},
1 => {test => 2},
2 => {test => 3},
3 => {test => 4},
},
};
How do I print the hash?
...
Hello! I remember something about not changing the keys in a
for my $key ( keys %hash ) { ...
for example
for my $key ( keys %hash ) {
$key = "$key_x";
}
But deleting keys and changing values would be fine.
Are my memories OK?
...
The goal of the following code sample is to read the contents of $target and assign all unique regex search results to an array.
I have confirmed my regex statement works so I am simplifying that so as not to focus on it.
When I execute the script I get a list of all the regex results, however, the results are not unique which leads me...
I have two interfaces on my server, eth0 and eth0:0. Those are two different external IP addresses and obviously two different reverse domains.
When I open a IO::Socket::INET connection, Perl uses the eth0 interface by default. I would like to use the second interface (eth0:0) because this has a different IP and I dont want to use my ma...
I'm trying to execute a copy of the Perl interpreter using Java's Runtime.exec(). However, it returned error code 9. After running the file a few times, the perl interpreter mysteriously started to return code 253 with no changes in my command at all.
What does code 253 / code 9 mean? A Google search for perl interpreter's exit codes tu...
Is there a simple way/module to map snmp(MIB) strings to OIDs in Perl?
E.g. I start with "sysUpTime.0" and get "1.3.6.1.2.1.1.3.0". As far as I can see, Net::SNMP expects you to have them already mapped.
...