Help Required on the Script

2006-04-04 Thread Mazhar
Hi Guyz, i am writin a script to automate the command snmpwalk by reading the contents of a file. Below is the snippet $file_name="somefile.txt"; open(FILE,"< $file_name"); while() { my $ip; my $comm_string; ($ip,$comm_string)=split(",",$_); $tempRNA=q

Sorting hash values

2006-04-04 Thread Baskaran Sankaran
Hi group, I am trying to process a hash (words as keys and frequency counts in an array as values). Instead of just sorting it by values, I want to sort it by the probabilities and I tried this... foreach $rule (sort {\&compute_probability($b) <=> \&compute_probability($a)} keys %rules_new) {

Re: perl script help

2006-04-04 Thread Irfan J Sayed
Thanks Ryan. It is working now. Regards Irfan Sayed Ryan Gies <[EMAIL PROTECTED]> 04/05/2006 11:18 AM To Ryan Gies <[EMAIL PROTECTED]> cc beginners@perl.org Subject Re: perl script help > Your file should be at: C:/per/lib/Mail/Sendmail.pm > Uh, make that: C:/perl/lib/Mail/S

Re: perl script help

2006-04-04 Thread Ryan Gies
Your file should be at: C:/per/lib/Mail/Sendmail.pm Uh, make that: C:/perl/lib/Mail/Sendmail.pm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: perl script help

2006-04-04 Thread Ryan Gies
If you have sendmail.pm (with a lower-case 's') it surely isn't the same thing as Sendmail.pm (with an upper-case 'S'). The MS Windows PATH environment variable is much different than Perl's @INC. Fortunately for you, your @INC includes C:/perl/lib. Your file should be at: C:/per/lib/Mail/Se

perl script help

2006-04-04 Thread Irfan J Sayed
Hi All, I have written a script to send a mail but when i am running that script i am getting following error. Can't locate Mail/Sendmail.pm in @INC (@INC contains: C:\irfan\ C:/perl/lib C:/p erl/site/lib .) at C:\irfan\DELIVE~2.PL line 30. BEGIN failed--compilation aborted at C:\irfan\DELIVE~2

Re: only one of two hash keys

2006-04-04 Thread Lawrence Statton
> Is there a nice clean perl way to test to see if only one key of a hash > has data? > > %some_hash = ( key1 => 1, key2 => 2 ); should fail the test > %some_hash = ( key2 => 2 ); should pass the test > %some_hash = ( key1 => 1 ); should pass the test > %some_hash = ( key1 => 1, key2 => 2, key3 =>

Re: only one of two hash keys

2006-04-04 Thread perl
On Wed, 2006-04-05 at 09:35 +0800, Jeff Pang wrote: > Hello, > > [EMAIL PROTECTED] ~/app]$ perl -le '%some_hash=(aa=>'bb');scalar keys > %some_hash == 1 ? print "true" : print "false"' > true > [EMAIL PROTECTED] ~/app]$ perl -le '%some_hash=(aa=>'bb',cc=>'dd');scalar > keys %some_hash == 1 ? pri

Re: only one of two hash keys

2006-04-04 Thread Jeff Pang
Hello, [EMAIL PROTECTED] ~/app]$ perl -le '%some_hash=(aa=>'bb');scalar keys %some_hash == 1 ? print "true" : print "false"' true [EMAIL PROTECTED] ~/app]$ perl -le '%some_hash=(aa=>'bb',cc=>'dd');scalar keys %some_hash == 1 ? print "true" : print "false"' false Is it useful for you? -Orig

only one of two hash keys

2006-04-04 Thread perl
Is there a nice clean perl way to test to see if only one key of a hash has data? %some_hash = ( key1 => 1, key2 => 2 ); should fail the test %some_hash = ( key2 => 2 ); should pass the test %some_hash = ( key1 => 1 ); should pass the test Thank you -- To unsubscribe, e-mail: [EMAIL PROTECTED]

RE: Local Server/Perl/HTML question...

2006-04-04 Thread Jim
> > I have just downloaded xitami and gotten it configured - I > hope correctly - on my W2K professional system. I've > installed PERL as well. > I put a PERL .PL in c:\xitami\cgi-bin and tried running it > by using my IE browser to run it. > > I'm sure the program runs as it creates thre

Re: simple profiling?

2006-04-04 Thread Bryan R Harris
> On Mon, 03 Apr 2006 16:23:40 -0700, Bryan R Harris wrote: >> Brian, any ideas why this doesn't work? >> >> ** >> % perl -MCPAN -e install Devel::SmallProf >> % perl -d:SmallProf ./pma base_2.pmai >> Can't locate Devel/SmallProf.pm in @INC (@INC contains: > ..

Re: How to manage around 1000 entries which will constantly be changing

2006-04-04 Thread Wagner, David --- Senior Programmer Analyst --- WGO
On 4/1/06, Frank Bax <[EMAIL PROTECTED]> wrote: > > At 06:59 PM 3/31/06, Mr. Shawn H. Corey wrote: > > > > >On Fri, 2006-31-03 at 15:45 -0800, Tom Phoenix wrote: > > > > You should loop over the input, pushing each item on to an array. If > > > > at any time you have 2000 items in the array, sort t

Re: Determine total days of month

2006-04-04 Thread John Ackley
My favorite is Date::Manip by Sullivan Beck - check www.cpan.org which does just about anything your can think of associated with date and time in just about any language use Date::Manip; $days=&Date_DaysInMonth($m,$y); Mike Blezien wrote: Hello, I am trying to come up with a function,

Re: Determine total days of month

2006-04-04 Thread Jay Savage
backwards. it's Because Why? posted. top hadn't you if advice better even been have would it but , advice good is This On 4/4/06, Joshua Colson <[EMAIL PROTECTED]> wrote: > # Sample code: > > use Date::Calc qw(:all); > > $days = Days_in_Month('2006','04'); > > print $days; > > # End Sample > > Yo

Accidental E-mail

2006-04-04 Thread Joseph Ruffino
I am sorry, I sent an e-mail to the mail list accidentally. If you got an e-mail for Staff Suggestion box, it was in error. I profusely apologize to everyone for this lack of intelligence on my part. I had this addy in my mail list here, and did not notice I was sending to everyone. -- Jos

Re: Determine total days of month

2006-04-04 Thread Mike Blezien
Joshua, thank you, that will do the trick. :) Mike - Original Message - From: "Joshua Colson" <[EMAIL PROTECTED]> To: Cc: "Mike Blezien" <[EMAIL PROTECTED]> Sent: Tuesday, April 04, 2006 1:58 PM Subject: Re: Determine total days of month # Sample code: use Date::Calc qw(:all); $d

Re: Determine total days of month

2006-04-04 Thread Chris Devers
On Tue, 4 Apr 2006, Mike Blezien wrote: > I am trying to come up with a function, or formula calculation, to > determine the total days of a given month, IE: April which has 30 > days, Feb has 28 days, March has 31 days... etc > > Is there way to do this with Perl Don't calculate it. Just use

Local Server/Perl/HTML question...

2006-04-04 Thread Richard.Copits
I have just downloaded xitami and gotten it configured - I hope correctly - on my W2K professional system. I've installed PERL as well. I put a PERL .PL in c:\xitami\cgi-bin and tried running it by using my IE browser to run it. I'm sure the program runs as it creates three directories like it'

Re: Determine total days of month

2006-04-04 Thread Joshua Colson
# Sample code: use Date::Calc qw(:all); $days = Days_in_Month('2006','04'); print $days; # End Sample You'll need the Date::Calc module from cpan (http://search.cpan.org/~stbey/Date-Calc-5.4/Calc.pod). On Tue, 2006-04-04 at 13:49 -0500, Mike Blezien wrote: > Hello, > > I am trying to come

Re: Determine total days of month

2006-04-04 Thread Tom Phoenix
On 4/4/06, Mike Blezien <[EMAIL PROTECTED]> wrote: > I am trying to come up with a function, or formula calculation, to determine > the total days of a given month, IE: April which has 30 days, Feb has 28 > Is there way to do this with Perl Nope. Perl is completely incapable of this sort of thi

RE: Determine total days of month

2006-04-04 Thread Timothy Johnson
There are plenty of modules out there to do this. Date::Calc is one, and a little creative use of Time::Local would also work, for example you could subtract one from the first day of the next month and then get the day. -Original Message- From: Mike Blezien [mailto:[EMAIL PROTECTED] Se

Determine total days of month

2006-04-04 Thread Mike Blezien
Hello, I am trying to come up with a function, or formula calculation, to determine the total days of a given month, IE: April which has 30 days, Feb has 28 days, March has 31 days... etc Is there way to do this with Perl TIA, Mike(mickalo)Blezien === Thunder Rai

Inhouse E-mail and others

2006-04-04 Thread Joseph Ruffino
Just to let you know, the inhouse e-mail system, the Staff Suggestion Box, and the Empoyee Status pages are down and we are working on it to get it up and running. We do not know how long it will take. I do not have everyone on my e-mail list on my computer, but I am confident enough people w

Re: Web Mail display library

2006-04-04 Thread JupiterHost.Net
Ramprasad A Padmanabhan wrote: 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

Re: Getting input from command window without hitting enter

2006-04-04 Thread Mr. Shawn H. Corey
On Tue, 2006-04-04 at 09:39 -0400, DiGregorio, Dave wrote: > I am trying to get a single character input from the command window > without requiring the user to hit enter. I have read in several places > that using stty and getc is not the best way to do this. Is there > another way that to do th

Getting input from command window without hitting enter

2006-04-04 Thread DiGregorio, Dave
I am trying to get a single character input from the command window without requiring the user to hit enter. I have read in several places that using stty and getc is not the best way to do this. Is there another way that to do this that I am not finding? I am using windows XP and perl 5.8.

Re: which subroutine

2006-04-04 Thread Dr.Ruud
Dr.Ruud schreef: > Tom Phoenix: >> the text eval is a dangerous and powerful beast, not >> easily tamed. Avoid avoid avoid. > > Ack. > > Do you know of a serious and safe way to use macros that are expanded > inline? > > For example: > > lookup_table 'table', 'run_', (cat, jackalope, yeti); > >

RE: simple profiling?

2006-04-04 Thread Peter Scott
On Mon, 03 Apr 2006 16:23:40 -0700, Bryan R Harris wrote: > Brian, any ideas why this doesn't work? > > ** > % perl -MCPAN -e install Devel::SmallProf > % perl -d:SmallProf ./pma base_2.pmai > Can't locate Devel/SmallProf.pm in @INC (@INC contains: ... Was the

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: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread Randal L. Schwartz
> "nishanth" == nishanth ev <[EMAIL PROTECTED]> writes: nishanth> Program will run as a daemon and you can kill it using nishanth> kill -9 Please stop pulling out "kill -9" as your first reach. It stops processes *dead* without giving them a chance to clean up. This is *in general* dangero

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread Randal L. Schwartz
> "James" == James Turnbull <[EMAIL PROTECTED]> writes: James> Anyone know of a way to create a loop (or something similar) that James> automatically schedules the execution of a sub-routine periodically from James> within a program, for example execute check() every 600 seconds or the like?

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread Dr.Ruud
Jeff Pang schreef: >> I still don't understand what the line >> > defined(my $pid = fork); >> >> is supposed to do. What does it do better than just >> >> my $pid = fork; > > You should please always do an judgement for the 'fork' call's > returning value. It would be better: > > my $pid = fo

Re: anonymize function return

2006-04-04 Thread John W. Krahn
Vadim Kutchin wrote: > Hi! Hello, > I have some function, such as: > > === > sub func1 { > my (%rez); > > $rez{one} = 'one'; > $rez{two} = 'two'; > $rez{seven} = 'seven'; > > return %rez; > } > ===

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread James Turnbull
Mr. Shawn H. Corey wrote: I assume your mainline is waiting on input. Like: while( <> ){ ... } Yes, that is correct. If you use alarm, then these waits will be interrupted by the alarm. So you need a flag to indicate this: my $alarmed = 0; sub wakeup { $alarmed = 1; #

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread perl
On Tue, 2006-04-04 at 12:52 +1000, James Turnbull wrote: > James Turnbull wrote: > > Hi > > > > Anyone know of a way to create a loop (or something similar) that > > automatically schedules the execution of a sub-routine periodically > > from within a program, for example execute check() every 60

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread Dr.Ruud
Nishanth Ev schreef: > Dr.Ruud: >> nishanth ev: >>> Dr.Ruud: nishanth ev: Man, what a mess you make of your entries. Please don't top-post. Please cut the text that you don't react upon, especially sigs and tails. > defined(my $pid = fork); What does that line do? It tests

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread Jeff Pang
> >I still don't understand what the line > defined(my $pid = fork); > >is supposed to do. What does it do better than just > > my $pid = fork; You should please always do an judgement for the 'fork' call's returning value. It would be better: my $pid = fork; die "can't fork:$!" unless

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread nishanth ev
Hello, It disassociates the process from the controlling terminal, or the login shell. Second, it removes the process from the process group that initiated the program. This ensures that the process is not a process group leader, which is required for setsid() to run successfully. Regards Nishan

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread Dr.Ruud
nishanth ev schreef: > Dr.Ruud: >> nishanth ev: Please don't top-post. Please cut the text that you don't react upon, especially sigs and tails. >>> defined(my $pid = fork); >> >> What does that line do? It tests $pid for defined, >> but the return value is not used. >> "or die $!" missing? > >

Re: which subroutine

2006-04-04 Thread Dr.Ruud
"Tom Phoenix" schreef: > the text eval is a dangerous and powerful beast, not > easily tamed. Avoid avoid avoid. Ack. Do you know of a serious and safe way to use macros that are expanded inline? For example: lookup_table 'table', 'run_', (cat, jackalope, yeti); would expand to: my %ta

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread nishanth ev
Hello, In case you want the die messages also... chdir '/' or die "Unable to chdir to /: $!"; open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; open STDERR, '>/dev/null' or die "Can't write to /dev/null: $!"; defined(my $pid = fork) or die "Can't fork: $!"; setsid

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread Dr.Ruud
nishanth ev schreef: > defined(my $pid = fork); What does that line do? It tests $pid for defined, but the return value is not used. "or die $!" missing? -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <

Re: Automatically scheduling the execution of a sub-routine

2006-04-04 Thread Dr.Ruud
"Omega -1911" schreef: > James Turnbull: Please don't top-post. Please cut the text that you don't react upon, especially sigs'n'tails. >> Anyone know of a way to create a loop (or something similar) that >> automatically schedules the execution of a sub-routine periodically >> from within a pro

Re: anonymize function return

2006-04-04 Thread Dr.Ruud
Vadim Kutchin schreef: > I have some function, such as: Missing: use strict; use warnings; > === > sub func1 { > my (%rez); > > $rez{one} = 'one'; > $rez{two} = 'two'; > $rez{seven} = 'seven'; > > return %rez; > } sub func1 {