-1
голосов
1ответов
430 просмотров

How do I process the data submitted from HTML Form?

I have written code to create a form to select multiple values. Below are some lines of my code to create a form to select multiple values. my $parser = Text::CSV->new(); open($csv_fh, '<', $csv_file) or die $!; my @headers = $parser->column_names( $parser->getline($csv_fh) ); print ...

22
голосов
7ответов
24686 просмотров

How can I maintain the order of keys I add to a Perl hash?

How can I maintain the order of actual list after counting its occurrence using a hash in the following program? For example, <DATA> are a b e a c d a c d b etc. Using hash, i counted the occurrence of each element. and what i want is: a 3 b 2 e 1 c 2 d 2 but the following p...

0
голосов
2ответов
1591 просмотров

How do I install the dependencies I need for MySQL::Slurp?

I am trying to install the mysqlslurp utility found in MySQL::Slurp. I found that it requires Moose and therefore I installed that package too. But I am still not able to use the mysqlslurp command. I get an error: Can't locate Moose.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/...

1
голосов
2ответов
248 просмотров

Why don't I get all the data when with my non-blocking Perl socket?

I'm using Perl sockets in AIX 5.3, Perl version 5.8.2 I have a server written in Perl sockets. There is a option called "Blocking", which can be set to 0 or 1. When I use Blocking => 0 and run the server and client send data (5000 bytes), I am able to recieve only 2902 bytes in one call. When...

4
голосов
3ответов
5180 просмотров

How can I extract start and end codon from DNA sequences in Perl?

I have a code below that try to identify the position of start and end codon of the given DNA sequences. We define start codon as a ATG sequence and end codon as TGA,TAA,TAG sequences. The problem I have is that the code below works only for first two sequences (DM208659 and AF038953) but not th...

49
голосов
8ответов
69224 просмотров

How can I find out where a Perl module is installed?

How do get the path of a installed Perl module by name, e.g. Time::HiRes? I want this just because I have to run my perl script on different nodes of a SGE Grid Engine system. Sometimes, even run as other username. I can use CPAN.pm to install packages for myself, but it is not so easy to insta...

1
голосов
2ответов
4355 просмотров

Why can't I open files returned by Perl's readdir?

Well, I know this is another newbie question but I'm very frustrated and I'm looking to be enlightened again. With the guidance of you guys, I've already learnt how to use the glob function to read the contents of each file in a directory. Now I'm trying the readdir-foreach combination to do the ...

0
голосов
2ответов
499 просмотров

Perl Digest::SHA1 not being imported on OS X Leopard Server

I've been trying to get SVN to connect to Atlassian Crowd for authentication but have been running into issues with OS X Leopard Server (10.5.8) and Perl's Digest::SHA1. I've installed it from the source (http://metacpan.org/pod/Digest::SHA1) and if I call it directly from a Perl script it works...

2
голосов
4ответов
977 просмотров

How can I make an HTTP GET request from Perl?

I'm trying to write my first Perl program. If you think that Perl is a bad language for the task at hand tell me what language would solve it better. The program tests connectivity between given machine and remote Apache server. At first program requests the directory listing from the Apache ser...

1
голосов
7ответов
375 просмотров

Recommendations for perl-to-python interoperation?

We have a sizable code base in Perl. For the forseeable future, our codebase will remain in Perl. However, we're looking into adding a GUI-based dashboard utility. We are considering writing the dashboard in Python (using tkinter or wx). The problem, however, is that we would like to leverage our...

2
голосов
5ответов
4822 просмотров

How can I use Perl to do datetime comparisons and calculate deltas?

I extracted year, month, day, hour, minute, second, and millisecond data from human readable text (it wasn't in a timestamp format, but rather something like "X started at HH:MM:SS.SSS on DD MMM YYYY and ended at HH:MM:SS.SSSS on DD MMM YYYY"), so for each recorded event, I have each of the value...

4
голосов
1ответов
1292 просмотров

Locale-aware Perl regular expressions (matching word boundaries)

I'm currently somewhat stuck getting a regular expression in Perl (taken from an earlier question of mine) to match word characters from a non-ASCII locale (i.e., German umlauts). I already tried various things such as setting the correct locale (using setlocale), converting data that I receive ...

-1
голосов
3ответов
3947 просмотров

Why aren't a batch file's environment variables set when run from Perl?

I am trying to invoke a bat file from a perl script as follows: system("call D:/SIP/run_$file_idx.bat"); However I observe that the environment variables in the bat fail to get resolved. If I run the bat file separately from the command prompt it works. Does system() create a new environmen...

5
голосов
5ответов
5844 просмотров

Why can't my Perl script see the our() variables I defined in another file?

I have a question relating to Perl and scoping. I have a common file with lots of various variables. I require the common file in my main script, but I cannot access the variables; they seem to be outside of its scope. I assumed that an our declaration would overcome that problem, but it doesn't ...

1
голосов
3ответов
1050 просмотров

How can I disable Perl warnings for svnnotify?

I'm using svnnotify. It works (sends email and all that) but it always outputs some error messages, such as Use of uninitialized value in substr at /usr/lib/perl5/site_perl/5.8.8/SVN/Notify.pm line 1313. substr outside of string at /usr/lib/perl5/site\_perl/5.8.8/SVN/Notify.pm line 1313. Use of...

7
голосов
2ответов
756 просмотров

How do I best make triggered accessors with defaults in Moose?

I have a situation where I'd like to cache some calculations for use later. Let's say I have a list of allowed values. Since I'm going to be checking to see if anything is in that list I'm going to want it as a hash for efficiency and convenience. Otherwise I'd have to grep. If I'm using Moos...

16
голосов
3ответов
6050 просмотров

How can I use a variable as a variable name in Perl?

I need to achieve the following in perl printmsg(@val1, $msg1) if @val1; printmsg(@val2, $msg2) if @val2; printmsg(@val3, $msg3) if @val3; printmsg(@val4, $msg4) if @val4; printmsg(@val5, $msg5) if @val5; printmsg(@val6, $msg6) if @val6; So i wrote the following snippet for(my $i=1; $i < 6...

0
голосов
4ответов
2230 просмотров

How can I print all the lines between the previous and next empty lines when a match is found?

I've racked my brain trying to come with a solution but in vain. Any guidance would be appreciated. _data_ mascot friend ocean \n parsimon **QUERY** apple \n jujube \n apricot maple **QUERY** rose mahonia \n ....Given the search keyword is QUERY, it would output: parsimon **QUERY** apple ap...

25
голосов
4ответов
39307 просмотров

What's the best way to deep copy a hash of hashes in Perl?

Possible Duplicate: What's the best way to make a deep copy of a data structure in Perl? Before I start coding this myself and reinventing the wheel, how do you copy a hash of hashes without duplicating the hashrefs? I'm reading a hash of hash of hashes via Config::General. i.e., the ...

8
голосов
2ответов
2190 просмотров

How can I install or upgrade a CPAN module that is in the latest Perl, without installing the new Perl?

I'd like to install a Perl module (in this case, FindBin), but since it is included in the Perl 5.10.1 distribution, cpan wants to install Perl 5.10 for me. Is there a way of installing just the module via cpan? The only option that I can see is installing directly from source, which seems a bi...

2
голосов
1ответов
177 просмотров

In Perl is there a difference between /^/ and /^/m?

The documentation for the /m option in perlre says this: Treat string as multiple lines. That is, change "^" and "$" from matching the start or end of the string to matching the start or end of any line anywhere within the string. But this example seems to indicate that /^/ and /^/m...

0
голосов
2ответов
556 просмотров

Why does the tarball directory structure disappear when I use Perl's Archive::Tar?

I'm using a Perl script to modify some files inside a .tar, and the directory structure inside the resulting .tar disappears. Eliminating more and more code I've come as far as all that's required to reproduce this is my $data_tar = Archive::Tar->new('data.tar'); $data_tar->write('modified...

2
голосов
8ответов
560 просмотров

How can I avoid Perl::Critic warnings when I process a multi-line string with a filehandle?

Does anyone have a solution to the task of processing a multi-line string one line at a time, other than the string-as-a-filehandle solution shown below? my $multiline_string = "line one\nline two\nline three\nline four"; my $filehandle; open( $filehandle, '<', \$multiline_string ) or cro...

2
голосов
3ответов
2570 просмотров

How can I compare md5 checksums in Perl?

I'm trying to compare the checksum value of a file. One variable $a has the checksum (output of md5sum command, only the hexadecimal part) and the same value is in variable $b. If I do ($a == $b), I am getting an error, but if I do ($a eq $b) it gives not equal. Thanks for your answers, it wor...

1
голосов
4ответов
778 просмотров

Why does my mod_perl script freeze my server?

I cannot make my Perl script run stable on the server. Here is the problem. When the script is accessed more than 5 times a second, the server freezes. And some time later the server hangs forever. SSH does not respond and I have to restart the server. I'm using Apache with mod_perl. The scrip...

9
голосов
2ответов
9147 просмотров

How can I parse JSON in Perl?

I want to use Perl script that gets the JSON data and converts it into XML file. How can I do that in Perl?

1
голосов
4ответов
238 просмотров

Perl's Regular Expression in a Tibetan Script

I am trying to remove/delete the second last character of a Tibetan script, as shown below (character in following example are of English): $char = "ti.be.tan.|"; So I want to remove the "second last" character "." I tried in following way with my few knowledge of RE: $char =~ s/...

3
голосов
3ответов
12388 просмотров

How do you install the Net::SFTP module on Ubuntu?

I'm new to Perl. How do you install the Net::SFTP module? I'm running Ubuntu Linux. I believe there's a simple way to do it from the command line, like by calling $ cpan install or something.

4
голосов
3ответов
11410 просмотров

How can I install local modules with the cpan tool?

my admin has given me sudo rights for cpan I also need to install a couple of non-CPAN modules (Atlassian Crowd -> svn connector) to the global PERL5LIB. I vaguely remember that cpan can install from local sources, without pulling modules from the web. any pointers? can I do it or shoul...

4
голосов
1ответов
168 просмотров

How do you localize a number of legacy globals without eval?

I'm asking this question because I finally solved a problem that I have been trying to find a technique for in a number of cases. I think it's pretty neat so I'm doing a Q-and-A on this. See, if I could use eval, I would just do this: eval join( "\n" , map { my $v = $va...