perl

How do you pronounce "->"?

Possible Duplicate: what is the official name of C++'s arrow (->) operator? I'm referring to the C operator which is used on pointers to mean the same think as the dot (".") would mean on the value. Incidentally, I'm most interested in how to pronounce it in perl as in $hello->world(). ...

Perl: Get the length of an array within a hash

I have the following: $data{host} -> [$i] -> {someotherstuff} How can I get the length of the array where [$i] is? Thanks! ...

How can I supply Maven release prepare information without prompts?

I want to automate the execution of Maven release:prepare with Perl so that the user doesn't have to answer the prompts for version names etc. Are there a -D arguments that can be supplied so that no prompting is done? I tried the obvious solution which is to feed the prompt answers to mvn via perl code like this: my $cmd = qq(mvn relea...

What is the preferred unit testing framework for Perl?

I'm sort of new to Perl and I'm wondering if there a prefered unit testing framework? Google is showing me some nice results, but since I'm new to this, I don't know if there is a clear preference within the community. ...

How can I match end-of-line multiple times in a regex without interpolation?

Hi, if I have a input with new lines in it like: [INFO] xyz [INFO] How can I pull out the xyz part using $ anchors? I tried a pattern like /^\[INFO\]$(.*?)$\[INFO\]/ms, but perl gives me: Use of uninitialized value $\ in regexp compilation at scripts\t.pl line 6. Is there a way to shut off interpolation so the anchors work as expe...

Does Perl have the equivalent of Python's multiline strings?

In Python you can have a multiline string like this using a docstring foo = """line1 line2 line3""" Is there something equivalent in Perl? ...

How can I get Devel::Cover results to show up in Hudson?

Is it possible to have the coverage statistics generated by Devel::Cover to show up in the project view in Hudson, much like the Cobertura plugin does? Even vague ideas are appreciated! ...

Writing reports with Perl

Hi, I am trying to write out multiple report files using perl. Each file has the same structure, but with different data. So, my basic code looks something like #begin code our $log_fh; open %log_fh, ">" . $logfile our $rep; if (multipleReports) { while (@reports) { printReport($report[0]); } } sub printReports { open...

How can I package sqlite with my Perl for Windows application?

I need to set up sqllite for Perl on a Windows box. However - Perl is probably being run over the network from a central server, and I do not know what modules will be available on initial running of my script. I can guarantee Perl 5.8+ (activestate) or Perl 5.10+ (strawberry). Therefore, I need to package sqlite & the associated Perl ...

How can I swap two consecutive lines in Perl?

I have this part of a code for editing cue sheets and I don't know how to reverse two consecutive lines if found: /^TITLE.*?"$/ /^PERFORMER.*?"$/ to reverse to /^PERFORMER.*?"$/ /^TITLE.*?"$/ What would it be the solution in my case? use strict; use warnings; use File::Find; use Tie::File; my $dir_target = 'test'; find...

How can I plot image data in Perl on Windows?

I would like to plot some image binary data on a grayscale matrix-like graph with custom values on axes. I'm using Perl on a Windows machine but I can't fine the right module to do this. I'm already using GD::Graph to plot other type of data but it seems unsuitable for this specific task. ...

If a process is killed with a sigkill how do I make it run again?

I have a process that other processes are trying to kill and if they manage to do it, how can I make sure the process will run again? ...

How can I output a list as comma-separated values in Perl?

Let's say I have a list of elements @list=(1,2,3); #desired output 1,2,3 and I want to print them as comma separated values. Most importantly, I do not want the last element to have a comma after it. What is the cleanest way to do this in Perl? ...

How can I pass two lists to a Perl subroutine?

Is it possible to pass two lists to a sub in Perl, for example: sub Foo { my(@list1,@list2) = @_; } I know I could make @_ two lists, with each sublist being the desired argument, I'm just wondering if there is a cleaner way ...

How can I capture multiple matches from the same Perl regex?

I'm trying to parse a single string and get multiple chunks of data out from the same string with the same regex conditions. I'm parsing a single HTML doc that is static (For an undisclosed reason, I can't use an HTML parser to do the job.) I have an expression that looks like: $string =~ /\<img\ssrc\="(.*)"/; and I want to get the v...

perl code to python code

can you convert this perl code to python code : $list = $ARGV[0]; open (PASSFILE, "$list") || die "[-] Can't open the List of password file !"; @strings = <PASSFILE>; close PASSFILE; Thanks ...

How do I best handle a needed patch for Perl/Tk?

I am making a change to Perl/Tk for an application that has its own resident Perl and modules installation (so we can drop the app in and go). I've found a problem I am experiencing that I just stumbled on what seems to be the patch I need here: http://osdir.com/ml/lang.perl.tk/2004-10/msg00030.html Bug confirmed. Here's the patc...

How do I fetch and parse HTML with Perl?

How do I do the following in Perl in order: a) curl a page and save it to a variable b) parse the value of the variable (which is HTML content) for values I want (ex: the info is kept between tags like ... ) ...

Grep and Extract Data in Perl

I have HTML content stored in a variable. How do I extract data that is found between a set of common tags in the page? For example, I am interested in the data (represented by DATA kept between a set of tags which one line after the other: ... <td class="jumlah">*DATA_1*</td> <td class="ud"><a href="">*DATA_2*</a></td> ... And then I...

How can I insert a line at the beginning of a file with Perl's Tie::File?

I'm trying to insert/add a line 'COMMENT DUMMY' at the beginnig of a file as a first row if /PATTERN/ not found. I know how to do this with OPEN CLOSE function. Probably after reading the file it should look something like this: open F, ">", $fn or die "could not open file: $!"; ; print F "COMMENT DUMMY\n", @array; close F; But I...