perl

How can I get the results of a Perl script in Python script?

I have one script in Perl and the other in Python. I need to get the results of Perl in Python and then give the final report. The results from Perl can be scalar variable, hash variable, or an array. Please let me know as soon as possible regarding this. ...

FastCGI C++ vs. A Script Language (PHP/Python/Perl)

What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job. Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). ...

How can I prettify Perl code generated by Perl?

I have a test generator written in Perl. It generates tests that connect to a simulator. These tests are themselves written in Perl and connect to the simulator via its API. I would like the generated code to be human-readable, which means I'd like it to be properly indented and formatted. Is there a good way to do it? Details follo...

Jmeter - Regex issue with embedded variable and $

Greetings, In Jmeter's regex component, I am running into an issue when the expression has both a variable AND a literal '$'. It always returns as fail. When I replace the variable with a hardcoded value, it works fine. I have verified the variable is returning the expected value in previous call. Failed Expression: (variable and lit...

UDP Server listening to broadcast

Given that: The server is on windows xp running ActiveState Perl The server is connected to an internal network and an external network A computer on the internal network is broadcasting in udp to 10.4.255.255 on port 9722 I need to: listen to the broadcast and pass the messages to a function This is the code I am using: my $sock; d...

What will happen if Perl tries to call move() on a file that is being uploaded?

Someone is FTPing a file of size 10Mb to folder on a linux server. While the file is in transition a cron wakes up and fires off a Perl script that is designed to look at the ftp folder and move whatever it finds there to some alternate folder. I'm using the move() function from File::Copy. The Perl process actually renames the files as...

What's the fastest way in Perl to get all lines of file1 that do not appear in file2?

I have two (very large) text files. What is the fastest way - in terms of run time - to create a third file containing all lines of file1 that do not appear in file2? So if file1 contains: Sally Joe Tom Suzie And file2 contains: Sally Suzie Harry Tom Then the output file should contain: Joe ...

Why would shl_load() fail for libraries with Thread Local Storage?

Threads in Perl by default take their own local storage for all variables, to minimise the impact of threads on existing non-thread-aware code. In Perl, a thread-shared variable can be created using an attribute: use threads; use threads::shared; my $localvar; my $sharedvar :shared; HP-UX runtime loader does not support dynamic load ...

Using Perl, how can I sort an array using the value of a number inside each array element?

Let's say I have an array, @theArr, which holds 1,000 or so elements such as the following: 01 '12 16 sj.1012804p1012831.93.gz' 02 '12 16 sj.1012832p1012859.94.gz' 03 '12 16 sj.1012860p1012887.95.gz' 04 '12 16 sj.1012888p1012915.96.gz' 05 '12 16 sj.1012916p1012943.97.gz' 06 '12 16 sj.875352p875407.01.gz' 07 '12 16 sj.875408p87543...

How do I match a Russian word in Unicode text using Perl?

I have a website I want to regexp on, say http://www.ru.wikipedia.org/wiki/perl . The site is in Russian and I want to pull out all the Russian words. Matching with \w+ doesn't work and matching with \p{L}+ retrieves everything. How do I do it? ...

Using Perl, how can I build a dynamic regexp by passing in an argument to a subroutine?

I would like to create subroutine with a dynamically created regxp. Here is what I have so far: #!/usr/bin/perl use strict; my $var = 1234567890; foreach (1 .. 9){ &theSub($_); } sub theSub { my $int = @_; my $var2 = $var =~ m/(??{$int})/; print "$var2\n"; } It looks like it will work, but it seems that once t...

What is the difference in Perl when passing a variable in a regular expression between using $variable and ${variable}

I am reviewing some ClearCase triggers written in Perl. I have noticed that in some regular expressions, variables are passed either straighforwardly or with their names in curly brackets. For example, I have the following line of code in a trigger: if ($baseline !~ /^${component}_(|.*_)$phase\.\d+(|[a-z]|-\d+|${automateddigit})$/ && ...

Does an uninitialized hash key have a default value of zero in Perl?

I have Perl code similar to the following: # -- start -- my $res; # run query to fetch IPv6 resources while( my $row = $org_ip6_res->fetchrow_arrayref ) { if( $row->[4] =~ /PA/ ) { $res->{ipv6}{pa}{$row->[2]}++; } elsif( $row->[4] eq 'PI' ) { $res->{ipv6}{pi}{$row->[2]}++; } } # -- stop -- At no point is...

What's the difference between sendmail via CGI vs. Perl?

I am using sendmail in perl and noticed (after much banging of head against wall) that when the script is run at the command line it needs you to leave out the \n(s) after your e-mail and the recipient's email address in order to format the mail correctly, but when running via CGI if those \n(s) aren't there it returns an error stating t...

What should I do with an object that should no longer be used in Perl?

I am writing a class that is linked to an external resource. One of the methods is a delete method that destroys the external resource. No further method calls should be made on that object. I was thinking of setting a flag and die'ing inside of all of the methods if the flag is set, but is there a better, easier way? Something invol...

How can I pre-allocate a string in Perl?

I have a Perl script that crunches a lot of data. There are a bunch of string variables that start small but grow really long due to the repeated use of the dot (concatentation) operator. Will growing the string in this manner result in repeated reallocations? If yes, is there a way to pre-allocate a string? ...

How can I redefine 'open' properly in Perl?

Some time ago, I ask a question: How do I redefine built in Perl functions? And the answers have served me well. I have a package that overrides Perl's 'open' function enabling me to log file access. Now I've come to a case that breaks the functionality of the original code. use strict; use warnings; use Data::Dumper; sub myopen (*;@...

How do I compile Perl 5.10 with thread support under FreeBSD 7.1?

I'm trying to compile Perl 5.10 on my FreeBSD 7.1 (BSD) server but when I run the Configure script and answer the questions I get the following error: ...POSTIX threads should be supported by FreeBSD 7.1 ... but your system is missing the shared libc_r. Googling for the answer came up with installing gethostnamadr.c which is fine exce...

Which repository contains LWP::Parallel::UserAgent?

Hi all, I need to install LWP::Parallel::UserAgent to run on Windows environment, I used ActivePerl 5.10. I search on Google but did not find any information about repo for this package Thanks, Minh. ...

How can I serve an image with a Perl CGI script?

My google fu in failing me. How do I use Perl to serve up an already generated image? Example: <http><body><img src="getimage.pl"></body></html> What goes in getimage.pl? ...