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 effici

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: [EMAIL

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 multipart

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 serve

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 Af

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]

Re: Numeric sort warning

2005-09-02 Thread Ramprasad A Padmanabhan
What do you get when you run perl -c Did you cut paste the program from some man page ? 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]

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: 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

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 PRO

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; u

Re: Emulate "tail -f" on file

2005-05-18 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 -

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 Spa

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. L

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: http://

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

examples using Template::Plugin::Page

2005-04-27 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 ---"

Re: Script that spans multiple files

2005-04-20 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 th

Anyone using AJAX

2005-04-14 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 --

RE: Command line parameters

2005-04-13 Thread Ramprasad A Padmanabhan
On Wed, 2005-04-13 at 12:32, Thomas BÃtzler 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 missin

Command line parameters

2005-04-12 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

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 --

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: http://cleanmail.netcore.co.in/direct

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 -- Netco

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

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 han

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. >

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); > }

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 > r

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

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

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 can

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: http://cleanmail.netcore.co.in/dir

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 seem

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

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 $

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 %h

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 @dayofyear=

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 =~s/\.[^.

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: 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]

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

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

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(); ---END--

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() someF

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 m

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 #SOME_

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: > >

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 workin

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 t

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.

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 th

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]

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 gramm

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: [EMAI

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 PR

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

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, e-mail

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

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 --

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]

X11::GUITest sendkeys with keycode ?

2004-10-07 Thread Ramprasad A Padmanabhan
Hi All, I came across this excellent module X11::GUITest , by which I can send inputs to X applications. My problem is I am not able to send special keys like HOME END etc Is there a way by which I can sendkeys using the keycode Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For a

perl regex to array

2004-10-04 Thread Ramprasad A Padmanabhan
Hi, I have slightly a tricky situation, in my large program. I am trying the best to reproduce it I have a string like this $x='a{1}b{21}c{5}d'; # The numbers in the {} are random and are not of interest I want to access all elements from the string 'a' 'b' 'c' & 'd' How do I do it best ?

How to set default text on Tk::Text

2004-09-30 Thread Ramprasad A Padmanabhan
I am creating a TK widget with a TK::Text textbox. I want to set the default text value as "hi" like this $txt = $mw->Text( # -data =>"hi", # This does not work -width => '10', -height => '10')->pack; But this is not working.

Re: Need help with script

2004-09-29 Thread Ramprasad A Padmanabhan
On Wed, 2004-09-29 at 18:55, PerlDiscuss - Perl Newsgroups and mailing lists wrote: > I have a file with the following format > > Object1 > "Description1" > > Object2 > "Description" > > Object3 > "Description" > > I would like the output in the following format > object1<...tab>Description

Re: regex help

2004-09-23 Thread Ramprasad A Padmanabhan
On Fri, 2004-09-24 at 11:01, Johnstone, Colin wrote: > Gidday all, > > Im trying to write a regex to convert spaces to underscores and ampersands to 'and' > can someone help. > > $safeString = "News & Events"; > $safeString =~ s/&/and/g; > $safeString =~ s/\s/_/g; > > Regards > > Colin > W

command line option with -ne to print newline

2004-09-17 Thread Ramprasad A Padmanabhan
Quick question, I want to run perl -ane '/REMARKS/ && print $F[1]' FILE1 FILE2 the problem is that there is no newline at the end of the every print. so I have to do perl -ane '/REMARKS/ && print $F[1] . "\n"' FILE1 FILE2 I thought there is a switch in perl by which I could auto pr

How to skip all tests while using CPAN

2004-09-14 Thread Ramprasad A Padmanabhan
I am installing some perlmodules using CPAN on commandline. Since I am doing this on multiple machines of the same architecture , I want to avoid "make tests" in CPAN , how can I do this ? Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE

Re: SMTP

2004-09-13 Thread Ramprasad A Padmanabhan
On Mon, 2004-09-13 at 14:36, Anish Kumar K. wrote: > HI > > I am using Active PERL for WINDOWS. How will I know > SMTP is Installed on the system...Can you suggest a small program for SMTP > > Anish > You can find if smtp is "running" very easily. Just make a connection to smtp port ( port 25 )

gmail api

2004-09-02 Thread Ramprasad A Padmanabhan
I tried the gmail api to send/recv mail Mail::Webmail::Gmail WWW::Scraper::Gmail WWW::GMail but all the three failed to make a connection. The problem I feel is that I am behind a http proxy Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

Re: OT: VIM perl indentaton

2004-08-27 Thread Ramprasad A Padmanabhan
On Fri, 2004-08-27 at 18:14, Chris Devers wrote: > On Fri, 27 Aug 2004, Ramprasad A Padmanabhan wrote: > > > On Fri, 2004-08-27 at 17:53, Gavin Henry wrote: > >> Hi all, > >> > >> Kind of a perl question, how do I get VIM to indent perl code? > > >

Re: OT: VIM perl indentaton

2004-08-27 Thread Ramprasad A Padmanabhan
On Fri, 2004-08-27 at 17:53, Gavin Henry wrote: > Hi all, > > Kind of a perl question, how do I get VIM to indent perl code? > > > -- > Just getting into the best language ever... > Fancy a [EMAIL PROTECTED] Just ask!!! Use emacs :-) Anyway on a serious note , I dont think there is any auto i

Re: how can I |more output.

2004-08-26 Thread Ramprasad A Padmanabhan
On Thu, 2004-08-26 at 13:26, Etienne Ledoux wrote: > My program starts with a menu with options. That being one of the options to > choose from. Once it is done it returns to the main menu again so you can run > other options again. I would like to be able to do this within my program > somehow

Re: how can I |more output.

2004-08-26 Thread Ramprasad A Padmanabhan
On Thu, 2004-08-26 at 12:28, Etienne Ledoux wrote: > Greetings, > > I have a program that does a search on a db and prints the output to the > screen. If there is a lot of output how can I a stop/continue displaying it. > like 'ls -l |more' would do. or anything |more for that matter. > > tx >

How to get contents of the clipboard

2004-08-17 Thread Ramprasad A Padmanabhan
Hi all, I am trying to write a perl script that requires the content of the clipboard. Is there a way I can do this? I am using Redhat AS 3 linux with a KDE desktop and Klipper Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: COMPLEX ARRAY STRUCTURE

2004-08-10 Thread Ramprasad A Padmanabhan
Luis Daniel Lucio Quiroz wrote: You are wrong, I need some more flexible, I dont know what attributes will be added, that's why I need array be coded on fly,with somthin like this $result = $ldap->add( 'cn=Barbara Jensen, o=University of Michigan, c=US', attr =>$attrs); so $attrs array is f

Re: COMPLEX ARRAY STRUCTURE

2004-08-09 Thread Ramprasad A Padmanabhan
This seems to be the result of a Net::LDAP search. I would suggest you better read the perldoc for the module , there are methods to directly give you the cn, sn etc from the entry. That way even if you upgrade the module and if the structure of the object changes you wont have to change any of y

Perl oneliner to delete lines from a file

2004-08-08 Thread Ramprasad A Padmanabhan
I want to write a command line perl 'script' to delete one or more lines from a file , by line number for eg in sed I can do the same in two steps cat FILENAME | sed -e '1,10d' >FILENAME.TMP mv FILENAME.TMP FILENAME The above mechanism has a lot of pitfalls , like maintaining permi

Re: reading log files in real time

2004-07-27 Thread Ramprasad A Padmanabhan
On Tue, 2004-07-27 at 19:50, Wiggins d Anconia wrote: > Please bottom post, this thread is unreadable. > > > > > Ramprasad, > > > > thanks for the heads up on File::Tail; > > > > unfortunatley the module isn't installed and we have a very tight > > restricttions on what we can install on produc

Re: reading log files in real time

2004-07-26 Thread Ramprasad A Padmanabhan
use File::Tail; Ram On Mon, 2004-07-26 at 18:19, Adrian Farrell wrote: > Hi, > > I'm looking for a way to read log files in real time, so that each time a > new entry appears in the file I can perform a search/query (whatever > really!) on it. > > it's odd really, as I expected this to be a ver

Re: a sed equivelent

2004-07-26 Thread Ramprasad A Padmanabhan
This should do your work, as long as your strings dont have any special chars. perl -pli.BAK -e 's/OLDSTRING/NEWSTRING/g' FILENAME (You can also use it for multiple files and will create a .BAK file incase you want to revert ) HTH Ram On Mon, 2004-07-26 at 17:21, Jerry M. Howell II wrote: > he

Re: Perl <-> Expect

2004-07-25 Thread Ramprasad A Padmanabhan
I dont think the ssh option is always available to everyone. Most times these hosts are non linux machines, so they dont come with ssh servers by default. Now If you dont have root access , you cant install ssh servers. But good old telnet is always available. ( I am not bothered about someon

Re: search and replace array variables contents

2004-07-20 Thread Ramprasad A Padmanabhan
On Tue, 2004-07-20 at 15:42, Baskaran wrote: > Dear sir, > > > I have two array variables. I want to find $a[1] and replace $b[1] in a > file. > ($a[1],$b[1] are array variables) > How to find and replace the variable contents. > > for ($i=0;$i<$totalnum;$i++){ > s/$a[i]/$b[i]/g; > } > You ha

Re: search text

2004-07-15 Thread Ramprasad A Padmanabhan
On Thu, 2004-07-15 at 05:04, manojkumar vajram wrote: > Plz. help me . I am new to perl > I want to accept a pattern from screen > and search the pattern in my one or two text data base > and print the details > > The pattern from screen may consist spaces and special > char. line / - etc. > I us

Re: Permutations (and optimisations)

2004-07-13 Thread Ramprasad A Padmanabhan
Good effort. But I use *Algorithm::Permute* Thanks Ram Robin wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, I have written a function that maybe others will find useful to play with. It takes a list and then c

Re: Executing scripts from different directories

2004-07-09 Thread Ramprasad A Padmanabhan
On Fri, 2004-07-09 at 11:14, sudhindra k s wrote: > > Hi > > I have two scripts abc.pl and xyz.pl. Now abc.pl uses xyz.pl. i have implemented > this as below. > > abc.pl > { > > > system("perl xyz.pl arg1 arg2"); > ... > } > > Now both abc.pl and xyz.pl are in the same directory c

Re: Help with @INC

2004-07-05 Thread Ramprasad A Padmanabhan
I dont know how to 'restore' your old @INC. Infact I too had a similar problem with multiple perl installations. What I did was set the environment variables PERLLIB and PERL5LIB to whatever your old installation in @INC. I hope you will get that from somewhere Thanks Ram On Mon, 2004-07-05 at 0

Re: IO::Socket for http download

2004-07-02 Thread Ramprasad A Padmanabhan
On Thu, 2004-07-01 at 18:24, Ramprasad A Padmanabhan wrote: > I want to write a basic http download ( text/binary) script using > IO::Socket. Does anyone have any examples anywhere. Thanks all, I found a basic and excellent example. ( It pays to be patient when using google) http://perl.

Re: IO::Socket for http download

2004-07-02 Thread Ramprasad A Padmanabhan
> LWP requires none of those tools. It does exactly what you are > describing: it opens a socket and uses the HTTP protocol to talk to the > server. > > Randy. > Right. Do you have any sample http client script , using IO::Socket If I get some sample script , my work will be reduced a lot

IO::Socket for http download

2004-07-01 Thread Ramprasad A Padmanabhan
I want to write a basic http download ( text/binary) script using IO::Socket. Does anyone have any examples anywhere. I know ,everyone must be wondering why I cant use ready modules like LWP. Well I want to auto transfer files to different remote machines. and these machines ( in all flavors of u

Re: Assigning a variable to hash keys and values

2004-06-29 Thread Ramprasad A Padmanabhan
On Tue, 2004-06-29 at 12:19, Daniel Falkenberg wrote: > Hello All, > > I currently have a hash of a hash... > > > %HoH = ( > > Key1=> { > > Apple => "Green", > > Banna => "Yellow", > > }, > > Key2=> { > >

Re: How to email my results to a group of people....

2004-06-29 Thread Ramprasad A Padmanabhan
If you do want to use perl, you can use dozens of perl modules. Learn MIME::Parser that will help you in lot of projects. But to be frank , just for sending attachments you dont need to write a perl script ( Though it is fairly simple ) . Just use mutt mutt -a attachment.file -f fromid -s "SUBJE

Net::Telnet set terminal

2004-06-28 Thread Ramprasad A Padmanabhan
I have a problem with Net::Telnet ( again ) When I connect to a united linux machine the server does not recognize terminaltype 'network' and the connection just hangs. Can I use telnet with a terminal type "vt100" in Net::Telnet Thanks Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For a

  1   2   3   4   >