perl

Using Haskell to extend Perl?

Has anyone ever written a Haskell extension to Perl? Maybe something simple, like a function that calculates the fib. sequence? I'm interested in using Haskell, and I see some overlap between the Haskell and Perl community. Any pointers to Haskell / Perl projects, or cool things that manage to use both of these? I've seen Language::Haske...

C# Public Key verify Perl Private key and use as AES key ? Possible and/or viable ?

Hi, i was thinking if it is possible and/or viable for obfuscation and security to do as the follow: Client start session with Server (which means a valid login and password was sent and accepted) Server encrypt a random password with it is Private Key that will then be used into a data encryption using Rijndael's method and send both...

perl help to parse log file based on time input

Perl newbie here. I have a log file that I need to parse out "Backup succeeded" and any "Error:" entries. I tried parsing the log file by using unix cat and piping it to grep. I got the information that I want, but I would like try this in perl and to also have the option to pass a date parameter and give me the lines based on the date I...

How can I access Perl variables in Java?

I need to get an array from Perl script to Java program. Can we directly access that variable in Perl directly from Java, or is there any way to return that array from the Perl program to the Java program? ...

How to make a hash available in another module

for Ex : package test1 ; my %hash = ( a=> 10 , b => 30 ) ; 1; in Script : use test1 ; print %hash ; # How to make this avilable in script without sub ...

PERL + match exactly string(from left side) in line

Hi all I have problem with the following perl command How to match all "1234" strings in file, but if some characters jointed before "1234" then it will not match, my problem is: if the string "1234" in the middle of the line then it not match why? The perl command: perl -pe 's/OLD/NEW/ if /^1234/' file Example of what need to matc...

array reference and dereferencing

for ex : my @array = @{$element->{$key}{'test'}}} ; print @array; # its shows array reference use Data::Dumper ; print Dumper @array ; # it print $VAR1 = [ '1' 2' ] How to access these values and how deference array ...

What do the line numbers refer to in perl -cw?

When I run "perl -cw" to check syntax for my perl modules and warnings or errors are encountered, two line numbers are given: perl -cw lib/My/Module.pm Global symbol "%badvar" requires explicit package name at lib/My/Module.pm line 93, <DATA> line 132. lib/My/Module.pm had compilation errors. The "line 93" is the correct position in t...

How to "unlink" a Perl array reference from the referenced variable?

In Perl 5.10.1: #!/usr/bin/perl my @a = (1, 2, 3); my $b = \@a; print join('', @{$b}) . "\n"; @a = (6, 7, 8); print join('', @{$b}) . "\n"; This prints 123 then 678. However, I'd like to get 123 both times (i.e. reassigning the value of @a will not change the array that $b references). How can I do this? ...

How do I view message context in Lokalize immediately in a pane?

All I see is just the file name and line number, as highlighted in the screenshot above. Activating the link shows a dialog box with the information: »Cannot open source files: no scripts to do so are currently loaded. Refer to the Lokalize handbook for script examples and how to plug them into your project.« However, after reading th...

How can I list files for an init.d script without ruby

I need to convert a init.d script that uses ruby to not use ruby. I can use perl or python or something else, but I can't use ruby. My main problem is figuring out how to dynamically get the list of *.jar files in a directory and separate them with ':'. The rest I could easily do with a bash script. Here is the Ruby code I'm working wit...

How can I remove specific duplicates with Tie::File?

I'm using this code to remove all duplicates, but I have a need to remove only specific duplicates and leave all others untouched. In my case if the line matches /^\s+INDEX 00 \d\d:\d\d:\d\d$/ then keep each unique first line, but delete duplicates, and keep all lines that don't match the regex. tie my @lines, 'Tie::File', $fn or die "...

How do I dynamically create a read-only contract in Perl?

My attorney gave me a 10 page contract that we need to fill in the blanks with the client name, pricing etc and then provide the client with a PDF or equivalent of the contract. I have looked at PDF::Create but it looks like I would have to create the entire document through code, not just the the placeholders. ...

How can I convert an ISO8601 timestamp into unix time in Perl?

Given a string that represents a date/time in ISO8601 format (e.g. 20100723T073000), I need to ultimately parse this into a user-supplied format using a general strftime format string. In order to do that, I need to convert the ISO8601 timestamp to a Unix timestamp. There are a huge amount of date/time manipulation modules for Perl and I...

PHP openssl equivalents for Perl ?

What would be a equivalent example in perl of the bellow code to create a Self-signed certificate ? All i have available is Crypt::OpenSSL::RSA (if there is another module let me know so i can verify it is available or possible to install as i am not the admin/owner and cannot do it myself due to rights issue) which i havent found on th...

Sum of tagged lines perl/shellscript

I have input that looks like 5 X 8 Y 3 Z 9 X I want output that sums the numerical values for each 'tag'; e.g. 14 X 8 Y 3 Z Wondering if there is a slick one liner I can use (along the lines of the ones for summing a list of integers using awk). ...

Parsing broken RSS feeds with Perl

I would like to be able to parse RSS and Atom feeds that contain non-valid XML. The errors I have encountered and would like to fix include "simple" things such as a &gt where the closing ; is missing, missing closing tags and closing tags that appear in the wrong order. I would like to ignore the question whether in theory it makes any...

Perl string sub

I want to replace something with a path like C:\foo, so I: s/hello/c:\foo But that is invalid. Do I need to escape some chars? ...

Perl basic questions

In Unix shell script we check the exit status of the previous command using the value of $? where zero equals success. How can I do it in Perl? When I run perl -V I see some paths listed in @INC. How do I add new paths to @INC? How can I set the order of arguments in the GetOptions function? I want -email to be the first argument and ...

dbi::Oracle error while running from cron

Hi I am using DBD::Oracle in my script to query into oracle database. When I am running this script its working fine but when i schedule to run this from cron its giving below error install_driver(Oracle) failed: Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libnnz1...