Re: translate IP mask

2008-10-16 Thread Sandy lone
On Thu, Oct 16, 2008 at 7:57 PM, John W. Krahn <[EMAIL PROTECTED]> wrote: > print "$ip/" . unpack "%32b*", inet_aton $mask; > ' Thanks, that's the cool solution. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: if condition question

2008-10-16 Thread Tom Yarrish
On Oct 16, 2008, at 8:08 AM, "John W. Krahn" <[EMAIL PROTECTED]> wrote: sanket vaidya wrote: Hi all, This is the exact same question you asked 16 days ago. Did you not like the answer you got then? (Which is the same as the answers you are getting now.) John -- Perl isn't a toolbox

Re: eval and script performance ?

2008-10-16 Thread Justin Hawkins
Deviloper wrote: The last time I considered using eval is years ago. I remember that I had read an article somewhere that doing eval could lead to dramatic performance issues. I want to use eval{} to check my db-transactions. I looking for informations at perldoc eval, but there is nothing me

using algorithm-permute

2008-10-16 Thread Sharan Basappa
Hi, I need to create permutations of a given set of values. The set is itself present in an array. From this I am trying to create another array that has permutations of this set. I am able to create a small example and run but from the description of the module I am not sure how to put the permu

Re: if condition question

2008-10-16 Thread John W. Krahn
sanket vaidya wrote: Hi all, This is the exact same question you asked 16 days ago. Did you not like the answer you got then? (Which is the same as the answers you are getting now.) John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools

RE: sendmail module

2008-10-16 Thread Jeff Pang
> Message du 16/10/08 14:12 > De : [EMAIL PROTECTED] > A : [EMAIL PROTECTED], beginners@perl.org > Copie à : > Objet : RE: sendmail module > > > > Hi All/Jeff, > > Somehow I am not able to install/configure Sendmail module. Can somebody > have another option/script/module then please let me know. >

RE: sendmail module

2008-10-16 Thread Irfan.Sayed
Hi All/Jeff, Somehow I am not able to install/configure Sendmail module. Can somebody have another option/script/module then please let me know. I am really stuck. Please help/advise. Regards Irf. -Original Message- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16,

Re: eval and script performance ?

2008-10-16 Thread Paul Johnson
On Thu, Oct 16, 2008 at 12:38:54PM +0100, Deviloper wrote: > The last time I considered using eval is years ago. I remember that I > had read an article somewhere that doing eval could lead to dramatic > performance issues. > > I want to use eval{} to check my db-transactions. I looking for > in

Re:Redirect option

2008-10-16 Thread Jeff Pang
> Message du 16/10/08 13:19 > De : "sheela b" > A : beginners@perl.org > Copie à : > Objet : Redirect option > > Is there any option to redirect a URL in perl other than Location ? Why not Location? If you use CGI.pm, you could look for redirect() method in it. But it is essentially printing a "L

Re: translate IP mask

2008-10-16 Thread Deviloper
Net::Netmask does such things, too. "John W. Krahn" <[EMAIL PROTECTED]> hat am 16. Oktober 2008 um 12:57 geschrieben: > Sandy lone wrote: > > I need to translate an IP addr with its mask from this form: > > > > 192.168.1.30/255.255.255.0 > > > > to this one: > > > > 192.168.1.30/24 > > One w

Re: translate IP mask

2008-10-16 Thread John W. Krahn
Sandy lone wrote: I need to translate an IP addr with its mask from this form: 192.168.1.30/255.255.255.0 to this one: 192.168.1.30/24 One way to do it: $ perl -le' use Socket; my $stuff = "192.168.1.30/255.255.255.0"; my ( $ip, $mask ) = split /\//, $stuff; print "$ip/" . unpack "%32b*

eval and script performance ?

2008-10-16 Thread Deviloper
The last time I considered using eval is years ago. I remember that I had read an article somewhere that doing eval could lead to dramatic performance issues. I want to use eval{} to check my db-transactions. I looking for informations at perldoc eval, but there is nothing mentioned about perfo

Re: Log::Log4perl

2008-10-16 Thread Deviloper
If this helps: I am using Log4Perl in a typical forked-to-background-daemon. I had to do a little thinking to figure out the best place to initialize Log4Perl. The problem is, that the utilized shared vars lost their sharedness in the child proc. Maybe you have to initialize your Log4Perl-Obje

Redirect option

2008-10-16 Thread sheela b
Is there any option to redirect a URL in perl other than Location ? Regards Sheela

Re: parse ini usage results in uninitialized value in concatenation

2008-10-16 Thread protoplasm
On Oct 14, 6:41 am, [EMAIL PROTECTED] (Protoplasm) wrote: > I'm attempting to write some code using the Config::INI::Simple > module. When I run the app I get the following: > > Use of uninitialized value in concatenation (.) or string at ./open- > file2.pl line 35. > Use of uninitialized value in

Re: if condition question

2008-10-16 Thread Paul Johnson
On Thu, Oct 16, 2008 at 03:20:13AM -0700, Jeff Pang wrote: > --- On Thu, 10/16/08, sanket vaidya <[EMAIL PROTECTED]> wrote: > > From: Chas. Owens [mailto:[EMAIL PROTECTED] > > > > > What you really want to say is > > > > > > print $string eq "test" ? "correct" : ""; print "correct" if $str eq "te

Re: if condition question

2008-10-16 Thread Chas. Owens
On Thu, Oct 16, 2008 at 06:12, sanket vaidya <[EMAIL PROTECTED]> wrote: snip > How can I write > > if ($string eq "test") { >print "correct" > } else { >die "others" > } > > In above way? snip In general, the ternary operator should only be used when choosing between two (or more in the ca

Re: Process start time in windows

2008-10-16 Thread Chas. Owens
On Wed, Oct 15, 2008 at 11:21, Zeba <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to write a perl program where I need to check when a > process was started. I have found a way to do this in linux. Can any > one help me on how to accomplish this in windows? I tried using the > tasklist windows co

RE: if condition question

2008-10-16 Thread Jeff Pang
--- On Thu, 10/16/08, sanket vaidya <[EMAIL PROTECTED]> wrote: > From: sanket vaidya <[EMAIL PROTECTED]> > Subject: RE: if condition question > To: beginners@perl.org > Date: Thursday, October 16, 2008, 6:12 AM > -Original Message- > From: Chas. Owens [mailto:[EMAIL PROTECTED] > Sent: Th

RE: if condition question

2008-10-16 Thread sanket vaidya
-Original Message- From: Chas. Owens [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2008 2:36 PM To: sanket vaidya Cc: beginners@perl.org Subject: Re: if condition question On Thu, Oct 16, 2008 at 04:54, sanket vaidya <[EMAIL PROTECTED]> wrote: snip > Now when I write the same if

Re: translate IP mask

2008-10-16 Thread Chas. Owens
On Thu, Oct 16, 2008 at 05:44, Sandy lone <[EMAIL PROTECTED]> wrote: > I need to translate an IP addr with its mask from this form: > > 192.168.1.30/255.255.255.0 > > to this one: > > 192.168.1.30/24 > > > which module/method is right to use? Thanks. A quick search of CPAN* turned up NetAddr::IP w

Process start time in windows

2008-10-16 Thread Zeba
Hi, I'm trying to write a perl program where I need to check when a process was started. I have found a way to do this in linux. Can any one help me on how to accomplish this in windows? I tried using the tasklist windows command, but that seems to give only the process ID and some other details (

translate IP mask

2008-10-16 Thread Sandy lone
I need to translate an IP addr with its mask from this form: 192.168.1.30/255.255.255.0 to this one: 192.168.1.30/24 which module/method is right to use? Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: cpan shell wrong

2008-10-16 Thread Sandy lone
On Wed, Oct 15, 2008 at 5:17 AM, <[EMAIL PROTECTED]> wrote: > I had a similar problem. Check out the contents of your urllist. This > is what mine looked like: > > cpan[1]> o conf urllist > urllist > 0 [] > 1 [ftp://carroll.cac.psu.edu/pub/CPAN/] > 2 [ftp://cpan-du

Re: sendmail module

2008-10-16 Thread Jeff Pang
Jeff. --- On Thu, 10/16/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > From: [EMAIL PROTECTED] <[EMAIL PROTECTED]> > Subject: sendmail module > To: beginners@perl.org > Date: Thursday, October 16, 2008, 5:25 AM > Hi All, > > > > I am using Perl 5.6.1 and want to sue sendmail module. I >

sendmail module

2008-10-16 Thread Irfan.Sayed
Hi All, I am using Perl 5.6.1 and want to sue sendmail module. I have copied the Sendmail.pm module to the mail dir. But still it is not executing properly. Following is the exact error. Can't locate MIME/Base64.pm in @INC (@INC contains: /usr/perl5/5.6.1/lib/sun4-solaris-64int /usr/perl5/5

Re: if condition question

2008-10-16 Thread Peter Scott
On Thu, 16 Oct 2008 14:24:56 +0530, sanket vaidya wrote: > use warnings; > use strict; Good! use warnings has shown you a bug in your code. > my $string = "test"; > > $string eq "test" ? print "correct" : ""; > > > Output: > > Correct > > Useless use of constant in void context at line 5.

Re: if condition question

2008-10-16 Thread Jeff Pang
--- On Thu, 10/16/08, sanket vaidya <[EMAIL PROTECTED]> wrote: > From: sanket vaidya <[EMAIL PROTECTED]> > Subject: if condition question > To: beginners@perl.org > Date: Thursday, October 16, 2008, 4:54 AM > Hi all, > > > > Kindly go through the below codes: > > > > use warnings; > >

Re: if condition question

2008-10-16 Thread Chas. Owens
On Thu, Oct 16, 2008 at 05:05, Chas. Owens <[EMAIL PROTECTED]> wrote: snip > What the ternary operator* is saying is roughly equivalant to snip Whoops, left out the footnote: * http://perldoc.perl.org/perlop.html#Conditional-Operator -- Chas. Owens wonkden.net The most important skill a program

Re: if condition question

2008-10-16 Thread Chas. Owens
On Thu, Oct 16, 2008 at 04:54, sanket vaidya <[EMAIL PROTECTED]> wrote: snip > Now when I write the same if condition in program as below, I get warning > along with output. snip > $string eq "test" ? print "correct" : ""; snip > Useless use of constant in void context at line 5. snip What the ter

if condition question

2008-10-16 Thread sanket vaidya
Hi all, Kindly go through the below codes: use warnings; use strict; my $string = "test"; if ($string eq "test") { print "correct"; } Output: Correct Now when I write the same if condition in program as below, I get warning along with output. use warnings; use strict;

Re: How to list all used modules?

2008-10-16 Thread Chas. Owens
On Thu, Oct 16, 2008 at 00:06, howa <[EMAIL PROTECTED]> wrote: > > Hello, > > Conside I have the code: > > use LWP::UserAgent (); > use Apache::DBI (); > use DBI (); > ... > ... > > Some points later, I want to list all the used modules, is it > possible? > > E.g. Print out > > LWP::UserAgent > Apa

Re: Different keys have same value in a hash?

2008-10-16 Thread Chas. Owens
On Wed, Oct 15, 2008 at 03:17, Marko Krstic <[EMAIL PROTECTED]> wrote: > Hello, > > What is the best (shortest) way to define a hash where different keys have > same values: > > %my_hash = { 1 => 'something', 2 => 'something', 3 => 'something else'}; > > Is there a way to write something like: > >

Re: How to list all used modules?

2008-10-16 Thread Rob Coops
On Thu, Oct 16, 2008 at 6:06 AM, howa <[EMAIL PROTECTED]> wrote: > > Hello, > > Conside I have the code: > > use LWP::UserAgent (); > use Apache::DBI (); > use DBI (); > ... > ... > > Some points later, I want to list all the used modules, is it > possible? > > E.g. Print out > > LWP::UserAgent >

How to list all used modules?

2008-10-16 Thread howa
Hello, Conside I have the code: use LWP::UserAgent (); use Apache::DBI (); use DBI (); ... ... Some points later, I want to list all the used modules, is it possible? E.g. Print out LWP::UserAgent Apache::DBI DBI Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional command

Re: variable in perl

2008-10-16 Thread Jean-Rene David
* Telemachus [2008.10.15 12:35]: > In Debian (and so probably many of its > children), perl-doc is a distinct package and > not installed automatically when you install the > perl package. > > Stupid, but true. Well, not to drift off-topic but it is my understanding that it is general Debian poli

Different keys have same value in a hash?

2008-10-16 Thread Marko Krstic
Hello, What is the best (shortest) way to define a hash where different keys have same values: %my_hash = { 1 => 'something', 2 => 'something', 3 => 'something else'}; Is there a way to write something like: %my_hash = { 1,2 => 'something', 3 => 'something else', etc...} Thanks -- To unsub