perl

How can I extract numeric data from a text file?

I want the Perl script to extract a data from a text file and save it as another text file. Each line of the text file contains an URL to a jpg like "http://pics1.riyaj.com/thumbs/000/082/104//small.jpg". I want the script to extract the last 6 numbers of each jpg URL, (i.e 082104) to a variable. I want the variable to be added to a diff...

Why would HMAC SHA-1 return a different digest with the same input?

I am trying to build a working encrypted signature for the Amazon S3 web service, writing a connection library using Objective C. I have run into HMAC SHA-1 digest problems with the ObjC code, so I'm putting that to the side and looking at existing, working Perl code, to try to troubleshoot digest creation. I am testing HMAC SHA-1 dig...

How can I remove the text before and after a particular character?

hi, I have been trying to remove the text before and after a particular character in each line of a text. It would be very hard to do manually since it contain 5000 lines and I need to remove text before that keyword in each line. Any software that could do it, would be great or any Perl scripts that could run on Windows. I run Perl scr...

Is there a Perl ORM with database reverse engineering?

I’m looking for a Perl ORM library that has support for reverse engineering of the database schema. All I’ve found so far is http://perlorm.sourceforge.net/ and it appears to have no reverse engineering support. ...

Which Eclipse distribution is good for web development using Python, PHP, or Perl?

I'd like to try out Eclipse, but I'm a bit baffled with all the different distributions of it. I mainly program in Python doing web development, but I also need to maintain PHP and Perl apps. It looks like EasyEclipse is a bit behind. Should I just grab the base Eclipse and start loading plug-ins? ...

How do I run a Perl script from within a Perl script?

I've got a Perl script that needs to execute another Perl script. This second script can be executed directly on the command line, but I need to execute it from within my first program. I'll need to pass it a few parameters that would normally be passed in when it's run standalone (the first script runs periodically, and executes the sec...

How can I quickly find the first line of a file that matches a regex?

I want to search for a line in a file, using regex, inside a Perl script. Assuming it is in a system with grep installed, is it better to: call the external grep through an open() command open() the file directly and use a while loop and an if ($line =~ m/regex/)? ...

What are the differences between Perl, Python, AWK and sed?

Hello, just want to know what are the main differences among them? and the power of each language (where it's better to use it). Edit: it's not "vs." like topic, just information. ...

Is there a Python equivalent to `perl -pi -e`?

I know of python -c '<code>', but I'm wondering if there's a more elegant python equivalent to perl -pi -e '<code>'. I still use it quite a bit for things like find and replace in a whole directory (perl -pi -e s/foo/bar/g * or even find . | xargs perl -pi -e s/foo/bar/g for sub-directories). I actually feel that that which makes Perl ...

How do I get the substed drive letter in Perl?

Hi there I need to get substed drive letter in Perl. Could anyone kindly help me? $ENV{SYSTEMDRIVE} does not work; it gives me real logical drive letter, not the substed one. thanxalot for your help ...

How can I reorder an mbox file chronologically?

Hello, I have a single spool mbox file that was created with evolution, containing a selection of emails that I wish to print. My problem is that the emails are not placed into the mbox file chronologically. I would like to know the best way to place order the files from first to last using bash, perl or python. I would like to oder by ...

How can I sort an mbox file by date?

Hello, I would like to know how to modify the below code to strip =20 characters at the end of many lines, and mainly to sort the messages chronologically from first received or sent to last. I am not sure if this would be an internal Perl routine or not. #!/usr/bin/perl use warnings; use strict; use Mail::Box::Manager; my $file = shi...

How can I handle a file with multiple encodings in it?

Hello, I have a small program to order and sort email messages, outputting to a textfile using $msg->decoded->string. The perl program outputs to stdout, and I redirect it to a txt file. However, gedit is unable to open this text file because of a character set problem, and I would like to know how to restore or set a character set with...

Should I use Module::Install or Module::Build?

I'm writing a programmer's text editor (yes another one) in Perl called Kephra, which is also a CPAN module of course and bundled with Module::Install. Recently I saw that Module::Build has gone into core, so if I switch I could reduce dependencies. Is there any other reason to switch? ...

How can I run Perl scripts using FastCGI on Nginx?

So I am following this guide: http://technotes.1000lines.net/?p=23 and I am going through the steps. I have a VPN (slicehost.com) with Debian Etch, serving a website (static so far) with nginx. I used wget to download FastCGI and I did the usual make make install routine. So I guess since FastCGI can't normally run CGI scripts you have...

Why is there no IronPerl (Perl for .NET)?

I'm a bit disappointed that there doesn't seem to be any effort to make Perl a first-class citizen of the .NET world. I've read a few 'reasons' in the past, but I don't see why they can't be overcome (different garbage collectors, hard-to-parse syntax, part of CPAN modules couldn't be ported, different communities, ...). Activestate ha...

How do you insert binary data into a BLOB column with Class::DBI?

I want to create a new object using Class::DBI. One of the fields of this object is a BLOB type. I have a filehandle I want to use for this data, but apparently, just doing this doesn't work: my $item = My::Class::DBI::Class->insert({ foo => $bar, biz => $baz, blob => $my_filehandle ...

How do you get the content type of an uploaded file using CGI::Application?

I am trying to process an uploaded file in a Perl program, using CGI::Application. I need to get the content type of the uploaded file. From what I read, the following should work, but it doesn't for me: my $filename = $q->param("file"); my $contenttype = $q->uploadInfo($filename)->{'Content-Type'}; As it turns out, $q->uploadInfo($...

Can I use multithreading with Perl's DBI and Oracle?

Does anyone know of any gotachs or problems when writing multithreaded Perl applications using the Oracle DBI? Each thread would have it's own connection to Oracle. For the longest time I was told multithreading was not supported in Perl with Oracle. ...

How can I efficiently manage Perl modules for code reuse?

hi there, My company develop web apps using combination of mod_perl, axkit and apache. We have tons of Perl modules, javascripts, etc, all in unix operating system. Whenever I need to write a new function, I try to do some code reuse, but the thing is all the Perl modules and javascripts are scattered across folders. i hate to write s...