base64 to hex conversion

2012-01-16 Thread Ramprasad Prasad
Hello what is the best way to convert base64 to hex I am currently using use NetSDS::Util::Convert qw ( conv_base64_str conv_str_hex); ... my $hex = conv_str_hex(conv_base64_str($b64)); But the NetSDS::Util module seems not so popular , I dont find it installed on most machines, Getting it

How do I implement a cyclic array in perl

2011-11-28 Thread Ramprasad Prasad
I have an array of scalars. I want to run a loop like this my @workers = qw ( a b c ); my $MAXCHILD = 20; foreach my $i( 0 .. $MAXCHILD){ run_job($i,$workers[$i++]); } Can I do this ?

How Do I insert a password into a PDF

2011-11-25 Thread Ramprasad Prasad
I am generating pdf files with http://code.google.com/p/wkhtmltopdf/ I want to password protect the PDF's .. How can I do this ?

Re: Stop the mail to me

2011-10-07 Thread Ramprasad Prasad
To unsubscribe, e-mail: beginners-unsubscr...@perl.org Read the footer of the mail

Determine http or https in CGI perl

2011-10-04 Thread Ramprasad Prasad
In my cgi program .. I want to know if the user is accessing via HTTP or HTTPS. How can I do this ? -- Thanks Ram http://www.netcore.co.in/ n http://pragatee.com

Cannot write to fifo

2011-08-29 Thread Ramprasad Prasad
How can I open multiple FIFO files in perl and print to them simultaneously I tried a simple script does not work #!/usr/bin/perl use strict; use IO::File; $|=1; system(rm -f /tmp/fifo1;mkfifo /tmp/fifo1); open (OUT, /tmp/fifo1) || die; for (0 .. 10){ print Hi $_\n; print OUT Hi $_\n;

OT: Apache vulnerability

2011-08-25 Thread Ramprasad Prasad
Will the apache DOS vulnerability affect servers just running CGI scripts , no php , tomcat etc( usually those are the ones causing all security concerns ) http://www.networkworld.com/news/2011/082411-apache-warns-web-server-admins-250075.html Are there any mitigation scripts

regex negative looking up a backtrace

2011-08-24 Thread Ramprasad Prasad
Assume I have to find the first unique character in a string $string = abtable; # t is the first unique string I tried using a negative backtrace lookup to get the answer in a single regex ... But something is missing. /(.).(?!\1)/ print $1; it seems fine ... But doesn't work -- Sent from

Re: regex negative looking up a backtrace

2011-08-24 Thread Ramprasad Prasad
still does not work $_ = zzabtable; /(.)(?!.*\1)/ print $1\n; Output is z On 8/24/11, Chris Charley char...@pulsenet.com wrote: Assume I have to find the first unique character in a string $string = abtable; # t is the first unique string I tried using a negative backtrace lookup to get the

Sorting an extremely LARGE file

2011-08-07 Thread Ramprasad Prasad
I have a file that contains records of customer interaction The first column of the file is the batch number(INT) , and other columns are date time , close time etc etc I have to sort the entire file in order of the first column .. but the problem is that the file is extremely huge. For the

Re: Sorting an extremely LARGE file

2011-08-07 Thread Ramprasad Prasad
On 7 August 2011 21:24, Shawn H Corey shawnhco...@gmail.com wrote: On 11-08-07 11:46 AM, Ramprasad Prasad wrote: I used a mysql database , but the order by clause used to hang the process indefinitely If I sort files in smaller chunks how can I merge them back ?? Please use Reply All when

Re: Sorting an extremely LARGE file

2011-08-07 Thread Ramprasad Prasad
Using the system linux sort ... Does not help. On my dual quad core machine , (8 gb ram) sort -n file takes 10 minutes and in the end produces no output. when I put this data in mysql , there is an index on the order by field ... But I guess keys don't help when you are selecting the entire

Re: Creating a detached process in perl cgi

2011-07-14 Thread Ramprasad Prasad
Ok I did get that working but not in pure perl. I put a system(nohup $process /dev/null 21 ); instead of all the fork and setsid On 13 July 2011 20:07, Shlomi Fish shlo...@shlomifish.org wrote: Hi Ram, On Wed, 13 Jul 2011 19:02:46 +0530 Ramprasad Prasad ramprasad...@gmail.com wrote: I

Creating a detached process in perl cgi

2011-07-13 Thread Ramprasad Prasad
I am trying a http API that would fork a background script and immediately return I tried using fork() and setsid() or using Proc::Background But the problem is my API hangs until the background script is complete Is there a way I can avoid this My code is here ( uses both fork and background

Re: Convert HTML to PDF

2011-06-15 Thread Ramprasad Prasad
On 14 June 2011 20:39, Dr.Ruud rvtol+use...@isolution.nl wrote: On 2011-06-14 10:54, Ramprasad Prasad wrote: I am trying to use PDF::FromHTML on my linux ( Fedora 12 ) machine [...] Is there a better way of creating PDF from HTML .. I believe this particular module is not much supported

Convert HTML to PDF

2011-06-14 Thread Ramprasad Prasad
I am trying to use PDF::FromHTML on my linux ( Fedora 12 ) machine I have just copied the man page example but I cant get it to run --- #!/usr/bin/perl use PDF::FromHTML; my $pdf = PDF::FromHTML-new( encoding = 'utf-8' ); $pdf-load_file('source.html'); $pdf-convert( Font

Extremely fast template processor

2011-05-27 Thread Ramprasad Prasad
I have a requirement of generating large number ( 100 thousand ) files from a single template by replacing the placeholders with respective values Currently I use Template-Toolkit, but is there a faster way ? Since my template is just dumb template ( no IF , no FOR etc ) .. I just need a simple

Re: Regular expression to capitalize first letter of words in sentence

2011-04-13 Thread Ramprasad Prasad
On 13 April 2011 11:40, Shlomit Afgin shlomit.af...@weizmann.ac.il wrote: Hi I need to write regular expression that will capitalize the first letter of each word in the string. Word should be string with length that is greater or equal to 3 letters exclude the words 'and' and 'the'.

Is CDB_File good for CDB in readonly

2011-04-04 Thread Ramprasad Prasad
I have a CDB database with 1 Million to 10 Million records .. This is just a key where the app needs to lookup if an entry exists or not. I dont need the value. My app will be looking up the key_exists() almost 100 times a second What is the fastest way of implementin this I have a few

Re: parsing a delimited file

2011-04-01 Thread Ramprasad Prasad
See Inline comments use strict; use warnings; my $fname = $ARGV[0]; open my $RFH,'',$fname; while ($RFH) { next unless /:/ and my %field = /(.*?):(.*?)/mg; # Wrong # I would prefer doing this chomp; if(/^(.+?)\:(.+?)/){ $field{$1}=$2;} }

How do I get the content-disposition of a MIME::Entity part

2011-03-11 Thread Ramprasad Prasad
I have a simple code that gets all image parts of a message foreach my $part($entity-parts){ next if ($part-effective_type !~ m{image}); push(@images,$part); ... } But I want to get only the inline images and not the attached images How can I achieve this ? $part-content_disposition()

Re: Auto correction of typos

2011-03-07 Thread Ramprasad Prasad
Now, the other part is the psychology on your end. What the hell is the point of maintaining an email database that you're afraid people have entered spam bot triggering emails into? You're either going to end up sending to it eventually or you're asking your users (and us) to give you

Auto correction of typos

2011-03-04 Thread Ramprasad Prasad
I have a web form where people sign up for updates by filling in their email address A lot of users end up not receiving the confirmation mailer because of typos in the email id Like yhaoo.com or hotmaill.com I would like to prompt the user for a possible typo , like the google Did you mean this

Re: advangtes of Perl on various languages

2011-01-05 Thread Ramprasad Prasad
On Tue, Jan 4, 2011 at 12:42 PM, Sunita Rani Pradhan sunita.prad...@altair.com wrote: Hi All I would like to know answers of following questions : - What all advantages Perl has on top of other scripting languages like Python , shell , Java ? - What is the career

Template Toolkit for HTML Table with variable number of columns

2010-12-04 Thread Ramprasad Prasad
I have to show report from a database of a daily report of ids. I have simplified the code here Pasted at http://pastebin.com/v0XmMuZP #!/usr/bin/perl use strict; use Template; use CGI; # Everyday report from DB for each id # my %report = ( '2010-12-01' = { 1 = 'OK' , 2 = 'FAIL' , 4 =

How do I recognize request from a mobile phone

2010-09-28 Thread Ramprasad Prasad
I need to display WAP version of pages when accessed from mobile, else WEB version What is the best of doing this -- Thanks Ram http://www.netcore.co.in/ n http://pragatee.com

CGI::Session persist session

2010-09-28 Thread Ramprasad Prasad
I am using CGI::Session for session management of a wap page. Even if I don't delete the cookie I have seen that from nokia browsers the cookie does not persist , but persistance works fine with a web browser like firefox Is there anything special needed for nokia browsers -- Sent from my mobile

Re: Imp

2010-08-30 Thread Ramprasad Prasad
On Mon, Aug 30, 2010 at 3:04 PM, Jyoti jcutiep...@gmail.com wrote: Hello everyone, Can anyone please guide me with specific CPAN perl libraries/modules, to send queries and get responses. I tried looking in CPAN,but I am still a learner, so not able to get properly. Can anyone reply me for

Best way of tailing a file

2010-08-10 Thread Ramprasad Prasad
On a linux server I need to tail -f a file continuosly in perl and whenever there is a new entry I insert into a DB If I use File::Tail::FAM I get this error Your vendor has not defined SGI::FAM macro FAM_DEBUG_OFF at /usr/lib/perl5/site_perl/5.8.8/File/Tail/FAM.pm line 16 I wanted to use FAM ,

Digital signatures using MIME::Lite

2010-08-09 Thread Ramprasad Prasad
Hi, I have a custome MIME::Lite / MIME::Parser script that picks up data from a DB and sends a mail. Now I need to digitally sign this mail Can I get some pointers , I dont know much about SSL -- Thanks Ram http://www.netcore.co.in/ n http://pragatee.com

Re: Digital signatures using MIME::Lite

2010-08-09 Thread Ramprasad Prasad
On Mon, Aug 9, 2010 at 2:47 PM, Jeff Pang pa...@arcor.de wrote: 2010/8/9 Ramprasad Prasad ramprasad...@gmail.com: Hi, I have a custome MIME::Lite / MIME::Parser script that picks up data from a DB and sends a mail. Now I need to digitally sign this mail What the module I have

parallel::forkmanager queue implentation in perl

2010-08-06 Thread Ramprasad Prasad
Hello , I have process that picks up multiple files from a directory forks child processes and each child process works on a batch of files and finishes the task I am thinking of this Parent process finds all files in jobs directory , divide tasks into $MAXCHILD processes but not exceeding

efficient max() function from sort

2008-05-28 Thread Ramprasad A Padmanabhan
I use sort to give the max of an array something like this - my @z = qw(12 24 67 89 77 91 44 5 10); my $max = ((reverse sort{$a = $b} (@z))[0]); print MAX = $max\n; --- but when I am interested only in a single max value, I need not sort the entire array Is there a more efficient

tracing Subroutine ** redefined at warnings

2006-10-20 Thread Ramprasad A Padmanabhan
I am getting warnings like ( when I run perl -wc ) Subroutine foo redefined at bar.pm. I am sure these functions are not redefined anywhere. I would like to trace the source of these warnings. How do I do this. BTW I am using perl 5.8.3 on linux Thanks Ram -- To unsubscribe, e-mail:

SOAP::WSDL cant get a simple example working

2006-06-13 Thread Ramprasad A Padmanabhan
Hi, I have installed the example server script test.cgi from SOAP::Clean examples Ref http://backpan.perl.org/authors/id/S/ST/STODGHIL/SOAP-Clean-0.02.readme Now I have a simple perl script just connecting to this server , but it is failing #!/usr/bin/perl use SOAP::WSDL; use strict; my

Web Mail display library

2006-04-04 Thread Ramprasad A Padmanabhan
Hi, I want to implement an email reader thru a web browser. Is there a utility which can parse mails in the standard unix mail format and display it in a html page. I tried to write my own using MIME::Parser , but that seems to be exceedingly tedious. I have to decide on which

Re: Expect script to install sshkey

2006-03-03 Thread Ramprasad A Padmanabhan
Wiggins d'Anconia wrote: Ramprasad A Padmanabhan wrote: Hi all, I have a perl Expect script that install rsa keys for ssh auto login. When I run the script on command line it works fine. Now when I run it inside a CGI the script simply gets stuck. I can see from the from the SSH server

Expect script to install sshkey

2006-03-02 Thread Ramprasad A Padmanabhan
Hi all, I have a perl Expect script that install rsa keys for ssh auto login. When I run the script on command line it works fine. Now when I run it inside a CGI the script simply gets stuck. I can see from the from the SSH server and also the expect logs that the login is happenning. But

Re: $ or % For Associative Arrays?

2005-09-02 Thread Ramprasad A Padmanabhan
Please read a book, like the perl beginners patiently. Anyway to explain in simple terms % is used for denoting the entire hash ( associative array ) $ is used for accessing a single element HTH Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Net::SMTP and a hash of arrays

2005-09-02 Thread Ramprasad A Padmanabhan
$email-recipient(@{ rcpts{$server} }); Thats the error IMHO TRY @{$rcpts{$server}} Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Numeric sort warning

2005-09-02 Thread Ramprasad A Padmanabhan
What do you get when you run perl -c file Did you cut paste the program from some man page ? Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

why does a usenet post take so long to appear

2005-09-02 Thread Ramprasad A Padmanabhan
I posted to this group using usenet ( nntp.perl.org ). My posts dont seem to appear any reason why ? Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Perl Expect .. getting output of command

2005-06-16 Thread Ramprasad A Padmanabhan
Randal L. Schwartz wrote: Ramprasad == Ramprasad A Padmanabhan [EMAIL PROTECTED] writes: Ramprasad $exp-expect(1); This means wait at most 1 second for *any* output. Yes I thought for a simple command like date that should be OK even If I put $exp-expect(1,/.*2005.*/s) I get no output

Perl Expect .. getting output of command

2005-06-15 Thread Ramprasad A Padmanabhan
I am using perl Expect to spawn a shell, run date and get its output .. I am not getting the full output of date Here is the script, can someone tell me where am I going wrong ? #!/usr/bin/perl use Expect; my $exp = Expect-spawn('bash'); print $exp-send(date\r); $exp-expect(1); my $str =

what is the MVC all about

2005-06-14 Thread Ramprasad A Padmanabhan
hi, I have been lately reading a lot of stuff about perl catalyst with MVC I am still not clear about practical use of MVC's Can someone provide pointers about MVC and where they are best used ? Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

MIME::Lite send_by_smtp cant change the default port

2005-06-03 Thread Ramprasad A Padmanabhan
Hi ALL, I am trying to send a mail using MIME::Lite I am trying to connect to port 26 of smtp server instead of 25 , but no luck I am not able to see anything wrong in this script , I hope I could get some inputs Thanks Ram -- My script is here #!/usr/bin/perl use strict;

Re: Emulate tail -f on file

2005-05-19 Thread Ramprasad A Padmanabhan
use File::Tail; On Thu, 2005-05-19 at 11:37, Tielman Koekemoer (TNE) wrote: Hi All, If I wanted to monitor a file in a way that would emulate tail -f (in the shell), how would I open the file? open(FILE, filename |); (?) TIA

getting filename in

2005-05-16 Thread Ramprasad A Padmanabhan
Hi all, I have a script that reads all input from the files specified in commandline like this while(){ ... } Inside the loop can I get the filename of the file from which is being read Thanks Ram -- Netcore Solutions Pvt. Ltd.

Anyone installed Net::LDAPapi

2005-05-16 Thread Ramprasad A Padmanabhan
I am not able to install Net::LDAPapi , I looked up google, seems that the module is no longer supported. Sad, I thought the interface of Net::LDAPapi is really gr8 Ram -- Netcore Solutions Pvt. Ltd. Website: http://www.netcore.co.in

Re: The last element

2005-05-07 Thread Ramprasad A Padmanabhan
On Sun, 2005-05-08 at 04:43, amr wrote: How can I call the last element in the array? I try the pop and it does the job but I think there is another way? $array[-1] HTH Ram -- Netcore Solutions Pvt. Ltd. Website:

Re: to fork process and use FIFO.

2005-04-30 Thread Ramprasad A Padmanabhan
On Sat, 2005-04-30 at 13:25, Sri Pen wrote: Need Help on how to fork process and use FIFO. I have 10 processes that I would like to fork form parent. Each process reads a different file, processes it and returns a log. I Need to consolidate all the Logs from all 10 processes and

examples using Template::Plugin::Page

2005-04-28 Thread Ramprasad A Padmanabhan
Hi all, I have a html reports page that has now grown too large to manage. I want to paginate my report. I am already using templates , similar to Template.pm so I would like keep the presentation stuff outside my perl code. I was trying to use Data::Page with Template::Plugin::Page but I am

regex substitution

2005-04-27 Thread Ramprasad A Padmanabhan
Hi all, I want a regex to replace all continuous occurrences of '-' with something else say 'x' except the first one These are some examples - Ram === - Ram -- bla=== -x blah bla --- === bla -xxx And also -- blah --- === -x blah

Re: Script that spans multiple files

2005-04-21 Thread Ramprasad A Padmanabhan
On Thu, 2005-04-21 at 11:09, Daniel Kasak wrote: Hi all. I have a large script ( 6000 lines ) that I'd like to break into logical units. Is there a way I can tell perl to 'append' a list of files into 1 script so that I can call subs from any of the files and have them treated as if they

Anyone using AJAX

2005-04-15 Thread Ramprasad A Padmanabhan
Hi, I am trying to learn using Ajax instead of form-oriented perl-cgi. ( fascinated with gmail :-) ) I have already started with CPAN modules Catalyst::Plugin::Ajax and HTML::Ajax. Do we have any good documenation / tool that can help me thanks Ram

Command line parameters

2005-04-13 Thread Ramprasad A Padmanabhan
I want to write a perl script like gnu less. My perl script accepts input on STDIN or filename(s) as arguments. If both are missing it should print the error message. How do I do this ? The pseudocode will be -- IF INPUT ON STDIN ;then Process STDIN ELSE IF ARGUMENT(S) is a

RE: Command line parameters

2005-04-13 Thread Ramprasad A Padmanabhan
On Wed, 2005-04-13 at 12:32, Thomas Btzler wrote: Ramprasad A Padmanabhan [EMAIL PROTECTED] asked: I want to write a perl script like gnu less. My perl script accepts input on STDIN or filename(s) as arguments. If both are missing it should print the error message. How do I do

Maillog parser for postfix

2005-04-12 Thread Ramprasad A Padmanabhan
Hi, Is there a module for parsing maillogs created by the postfix smtp server. I think there is one for sendmail .. but not for postfix. I am required to do some reporting using the maillog .. Should I just go ahead an write my own parser ? Thanks Ram

quick regex question

2005-03-31 Thread Ramprasad A Padmanabhan
Hi, I want to run a substitution for all instances of _ with . after '@' in a string but _ before @ should not be touched. eg $str = [EMAIL PROTECTED]; Should become [EMAIL PROTECTED] Any suggestions Thanks Ram -- Netcore

Changing euid egid of a perl process at runtime

2005-03-31 Thread Ramprasad A Padmanabhan
Hi, I want my script started as root to run as user postfix. How do I change the uid gid of the process Thanks Ram -- Netcore Solutions Pvt. Ltd. Website: http://www.netcore.co.in Spamtraps:

db handles with fork()

2005-03-30 Thread Ramprasad A Padmanabhan
Hi, I am writing a perl application that connect to a database and then does a fork() The child completes the process and does a exit(), but the problem is it closes the database connection which the parent would like to use. Can I exit the child process without disconnecting the parent dbi

RE: db handles with fork()

2005-03-30 Thread Ramprasad A Padmanabhan
I would strongly recommend you connect after the fork. Each process needs to have its own connection. Thanks for the reply. Even I had thought so, probably for efficiency I can use dbi cached_connect Ram -- Netcore Solutions Pvt.

Re: When does a process become defunct

2005-03-28 Thread Ramprasad A Padmanabhan
On Mon, 2005-03-28 at 14:35, Steven Schubiger wrote: On 28 Mar, Ramprasad A Padmanabhan wrote: I am writing a daemon in perl , where the parent just forks on some requests and the children take over. But I found many child processes becoming defunct. wait(); perldoc -f waitpid I

When does a process become defunct

2005-03-27 Thread Ramprasad A Padmanabhan
Hi all, I am writing a daemon in perl , where the parent just forks on some requests and the children take over. But I found many child processes becoming defunct. I am not sure why. I am catching SIG_CHLD alright. To reproduce the problem I have just written a skeleton of my script. The parent

Regex to remove non printable characters

2005-03-21 Thread Ramprasad A Padmanabhan
Hello All I want to remove all characters with ascii values 127 from a string Can someone show me a efficient way of doing this. Currently what I am doing is reading the string char-by-char and check its ascii value. I think there must be a better way. Thanks Ram

Re: Calling a perl script within another

2005-03-18 Thread Ramprasad A Padmanabhan
After a small change This works perfectly fine thank you all { $scriptname = get_scriptname($recipient) local(@_) = ($arg1,$arg2,$arg3); do($scriptname); $output = $global::output; # This variable is set by the $scriptname do_something($output); } I

Calling a perl script within another

2005-03-17 Thread Ramprasad A Padmanabhan
Hi all, I have a requirement to call a perl script within another and take the output for example { $script = foo(); $output = `perl $script $a $b $c `; do_someting($output); ... } The above works fine , but I do not want to fork out a new perl process every time. Is there a way I

Re: Calling a perl script within another

2005-03-17 Thread Ramprasad A Padmanabhan
If the code for $script is being generated by the foo() subroutine, then why are you not just eval()ing on the spot? { $script = foo(); $output = eval{ $script } or die Couldn't eval code: $script\n$!\n; do_something($output); } I am sorry

Re: Calling a perl script within another

2005-03-17 Thread Ramprasad A Padmanabhan
Okay, so we're back to my other suggestion -- require it: { $script = get_name_of_script(); # names matter! pick good ones! $output = require $script or die Couldn't 'require' $script\n$!\n; do_something($output); } No I cant use require.

Re: Calling a perl script within another

2005-03-17 Thread Ramprasad A Padmanabhan
Well, yes, but the way you've designed this, you already run that risk. Now if you replaced get_scriptname() with get_subroutine(), and found a way to abstract out the bits that are different for each $recipient, then you could simplify things tremendously, and hopefully make your

Mail 2 sms module

2005-03-14 Thread Ramprasad A Padmanabhan
Hi all, Is there any module that can help me convert text or html mail to text that can be sms-ed I looked at the email2sms utility, but that does not provide any includable module and doesnt work well with text html mails. Thanks Ram

Re: Best way to check if element exists

2005-03-11 Thread Ramprasad A Padmanabhan
print exists if $hash{key}; Obviously. But If I am just checking key exists , Is it worth having a DB_File Hash Thanks Ram -- Netcore Solutions Pvt. Ltd. Website: http://www.netcore.co.in Spamtraps:

DB_File Not getting hash values

2005-03-10 Thread Ramprasad A Padmanabhan
Hi, I have a simple script that reads a hashDB file into a tied hash. When I do a Dumper , I get the hash values , but when I pring a value nothing is printed ... what am I doing wrong here ? use DB_File; use strict; use Data::Dumper; my

DB_File Not getting hash values

2005-03-10 Thread Ramprasad A Padmanabhan
Hi, I have a simple script that reads a hashDB file into a tied hash. When I do a Dumper , I get the hash values , but when I pring a value nothing is printed ... what am I doing wrong here ? use DB_File; use strict; use Data::Dumper; my %hash; my

Re: DB_File Not getting hash values

2005-03-10 Thread Ramprasad A Padmanabhan
Ramprasad A Padmanabhan wrote: Hi, I have a simple script that reads a hashDB file into a tied hash. When I do a Dumper , I get the hash values , but when I pring a value nothing is printed ... what am I doing wrong here ? use DB_File; use strict

Best way to check if element exists

2005-03-10 Thread Ramprasad A Padmanabhan
Hi All, Maybe this is OT , I am sorry for that. I have a specific email application , where I want to check if a particular id exists or not in a file. Since this happens at real time I want the application to be as fast as possible. I am currently using DB_File hash, but that

Re: 2 -D arry in perl

2005-03-09 Thread Ramprasad A Padmanabhan
Adam Saeed wrote: hi i am some new to per;. I want to get a day numbers by year and store them in e a 2 -d array, getting data from mysql. i.e data[dayofyear][year] BUT I COULD NOT GETTING THE DESIRE RESULT ... ANY HELP my snap code is: ... ... @year #have list of years my $i=0; my

Re: reading an file

2005-03-08 Thread Ramprasad A Padmanabhan
E.Horn wrote: Hello! I want to read this file into an array. How can i just get 4, 5, 6,7,8 into an array? Post what you have already tried. What you want to do is not very clear. Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: AW: How to remove everything after the last . dot?

2005-03-08 Thread Ramprasad A Padmanabhan
Bastian Angerstein wrote: Hmmm... use strict; use warnings; my $a=i.like.donuts.but.only.with.tea; $a=~s/\.\w+$//; # maybe w+ not d+??? Better still $a =~s/\.[^.]+$//; Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How to remove everything after the last . dot?

2005-03-08 Thread Ramprasad A Padmanabhan
Bastian Angerstein wrote: I have a line: i.like.donuts.but.only.with.tea now I want to remove everything that follows the last . including the last .. in this case .tea Use Regex To read the manual perldoc perlre Of course In your case you could simply do something like this $line

Substitute Regex with 'e'

2005-02-14 Thread Ramprasad A Padmanabhan
Hi I want to so a substititue a string Say my %hash = ( 1130, a , 2100, b); $x = 'SOMEJUNK 1130'; # I want $x to be'1130a' # This regex does not work $x=~s/^(.*?) (\d+)/ $2 . { defined $hash{$2} ? $hash{$2} : 'NOTFOUND' } /e; Can someone fix the regex for

RE: How to find the Index of an element in array?

2005-01-27 Thread Ramprasad A Padmanabhan
On Thu, 2005-01-27 at 13:10, Mallik wrote: Hi, Thanks for ur reply. Is there any function instead of looping thru entire array. Mallik. You can do fancy stuff like below, but this may not be necessarily better. Can you post where you are trying to use this ? What is there is more

using namespace

2005-01-27 Thread Ramprasad A Padmanabhan
Is there anyway I can do a using namespace for a particular loop like in c++; ( for functions not exported ) FOr eg in a perl script use Some::Module { using namespace Some::Module; # Is this possible ? someFuntion1(); # Instead of Some::Module::someFunction1()

RE: using namespace

2005-01-27 Thread Ramprasad A Padmanabhan
Hi Manav, But still import does not work across multiple files. for eg, main.pl- #!/usr/bin/perl # use Some::Module qw(someFunction1); require MyLibModule; # This function will now work someFunction1(); MyLibModule::someOtherFunction();

RE: using namespace

2005-01-27 Thread Ramprasad A Padmanabhan
On Thu, 2005-01-27 at 15:11, Manav Mathur wrote: use semantics internally do an import. By multiple files, do you mean multiple packages?? see perldoc -f use for the code that you have listed below, you'll have to 'use' Some::Module inside package MyLibModule. for perldoc The import

Regex lookahead problem

2005-01-11 Thread Ramprasad A Padmanabhan
I have a string $X='#SOME_STRING END'; I want to remove the begining '#' and ending 'END' but retain everything in between. This way works fine $X=~s/^#(.*?) END$/$1/; # $X is now SOME_STRING But this way does not s/^#(?=.*) END$//; ## $X is still

RE: Checking if a scalar value is a number or not

2004-12-01 Thread Ramprasad A Padmanabhan
On Wed, 2004-12-01 at 19:04, Bob Showalter wrote: Ing. Branislav Gerzo wrote: Mat Harris [MH], on Wednesday, December 1, 2004 at 12:19 (+) contributed this to our collective wisdom: Is there any special function for that job? personally I would use a rexex: if

Re: How to install LWP.pm module

2004-11-25 Thread Ramprasad A Padmanabhan
On Thu, 2004-11-25 at 11:43, Prabahar Mosas wrote: Dear All, I am using perl 5.00503. In this perl lot of pm modules are missing. I want to add LWP.pm,Warnings.pm in this perl. If anybody know regarding this mail me. You will have to upgrade perl to get warnings working.

Re: Reconfiguring PERL

2004-11-22 Thread Ramprasad A Padmanabhan
On Mon, 2004-11-22 at 15:43, Richard Foley wrote: How do I reinitialize/reconfigure my PERL installation (v5.8)? I fear my initial configuration is flawed as I cannot install modules or upgrade Bundle::CPAN ... keep getting errors related to ncftp, etc. Thank you. Fix your CPAN first.

False warning by warnings.pm

2004-11-22 Thread Ramprasad A Padmanabhan
I am using Net::Telnet in one of my perl scripts. Problem is every time it runs with use warnings It prints out warnings like Unrecognized escape \s passed through at Where that line is $t-waitfor(/ord\s*:\s*/); Which is perfectly OK ( I think ) Can someone tell how to get rid of

Net::SMTP change port

2004-11-19 Thread Ramprasad A Padmanabhan
I am using Net::SMTP to send mails to an SMTP server. If the server is running on a non std port how do I send mails to this port Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: :SMTP change port

2004-11-19 Thread Ramprasad A Padmanabhan
On Fri, 2004-11-19 at 21:13, Bob Showalter wrote: Ramprasad A Padmanabhan wrote: I am using Net::SMTP to send mails to an SMTP server. If the server is running on a non std port how do I send mails to this port Not documented, but inspection of the Net::SMTP code shows that: $smtp

Re: perl module - Statistical mean and sd

2004-11-18 Thread Ramprasad A Padmanabhan
Chris Devers wrote: Please make an effort to use conventional spelling. any1 isn't cute; it's annoying. No offence intended , but I think that is still ok. I think it is in the spirit of perl to reduce typing as much as possible. After all we just are sharing knowledge, not writing a

Re: how to read header of messages on server using socket

2004-11-17 Thread Ramprasad A Padmanabhan
On Wed, 2004-11-17 at 17:36, supriya devburman wrote: hi can anybody tell me how to read header of incoming messages on pop3 mail server using socket. Thnx use Mail::POP3Client http://search.cpan.org/~sdowd/POP3Client-2.13/POP3Client.pm Ram -- To unsubscribe, e-mail: [EMAIL

Re: Sourcing Configuration files

2004-11-02 Thread Ramprasad A Padmanabhan
On Tue, 2004-11-02 at 13:41, Gavin Henry wrote: Hi all, What is the easiest way to move variable declarations out into a file in /etc/ and requiring a perl program to read them in at startup. If they are not there, then the program must complain. Thanks. You cannot source shell style

How to find if the script is running on a 32-bit machine

2004-11-02 Thread Ramprasad A Padmanabhan
In a particular script , that is used on multiple unix platforms, I need to know if my perl script is being run on a 32 bit machine or a 64 bit machine Is there any way I can find this portably Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

LWP::Simple use proxy

2004-10-25 Thread Ramprasad A Padmanabhan
Hi All, I am using LWP::Simple; I want use of proxy to be enabled from the environment. In LWP::UserAgent there is a method env_proxy by which I can do this. How can I do a similar thing for LWP::Simple; Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Course material for perl training

2004-10-11 Thread Ramprasad A Padmanabhan
Sorry for being OT here Is there any good course material for a perl crash course. I am supposed to take training in perl and prepare a syllabus , with exercises Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Line replace

2004-10-11 Thread Ramprasad A Padmanabhan
On Mon, 2004-10-11 at 16:23, Urs Wagner wrote: Hello I should comment out lines in a text file. I have a lot of troubles to realize this. The lines Alpha(a, b, c) should be changed to # Alpha(a, b, c) perl -pli.BAK -e 's/(?=.*Alpha\(a, b ,c\))/#/' FILENAME HTH Ram -- To

Re: Can do in 1 while loop?

2004-10-11 Thread Ramprasad A Padmanabhan
On Mon, 2004-10-11 at 06:26, loan tran wrote: Hello Perl Gurus, I wrote a script to search for log suspends and bloking processes in a text file and send me email if it find either of them. My codes below work but it's not efficent. As you can see I open the file and go to while loop

  1   2   3   4   5   >