Re: first ip and last ip

2007-08-12 Thread pennyyh
-Original Message- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: beginners@perl.org Sent: Mon, 13 Aug 2007 1.29PM Subject: Re: first ip and last ip Hi, Take a look at Net::IP http://search.cpan.org/~manu/Net-IP-1.25/IP.pm Thanks!That works fine and is easy to use.

Re: first ip and last ip

2007-08-12 Thread Laxminarayan G Kamath A
On Mon, 13 Aug 2007 00:30:27 -0400, [EMAIL PROTECTED] wrote: > Given this ip range, > 64.12.0.0/16 > Is there any way to get the first ip and last ip in it by Perl? Look at the program ipcalc.. it does the same thing and more (in perl).. http://jodies.de/ipcalc I would still recommend searching

Re: first ip and last ip

2007-08-12 Thread yaron
Hi, Take a look at Net::IP http://search.cpan.org/~manu/Net-IP-1.25/IP.pm Yaron Kahanovitch - Original Message - From: [EMAIL PROTECTED] To: beginners@perl.org Sent: Monday, August 13, 2007 7:30:27 AM (GMT+0200) Auto-Detected Subject: first ip and last ip Hello, Given this ip range,

first ip and last ip

2007-08-12 Thread pennyyh
Hello, Given this ip range, 64.12.0.0/16 Is there any way to get the first ip and last ip in it by Perl? Thanks. Check out the new free AOL Email -- 2GB of storage and industry-leading spam and email virus protection. -

Re: Array to Hash

2007-08-12 Thread Jeff Pang
-Original Message- >From: yitzle <[EMAIL PROTECTED]> >Sent: Aug 12, 2007 10:55 PM >To: "beginners@perl.org" >Subject: Array to Hash > >I got an array of values where the order is relevent, eg the ages of >Alice, Bob and Charles, and I want to make a hash out of it. I got >this code that

Array to Hash

2007-08-12 Thread yitzle
I got an array of values where the order is relevent, eg the ages of Alice, Bob and Charles, and I want to make a hash out of it. I got this code that does it: my %ages = (alice => $r[0], bob => $r[1], charles => $r[2]); Is there a more elegent way to do it? -- To unsubscribe, e-mail: [EMAIL PR

How to determine whether a file is readonly on win32

2007-08-12 Thread Zhao, Bingfeng
Hi, list, I use perl on Win32 platform mostly. In order to automated the process of version control and code review, I need check whether a file is readonly and make it readonly if necessary. But perl seems unfriendly to win32 and there is no corresponding -X available. Who can give me the simplest

Re: import perl module after edit

2007-08-12 Thread Chris Pax
On Aug 12, 12:17 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > Paul Lalli wrote: > > On Aug 11, 7:18 pm, [EMAIL PROTECTED] (Chris Pax) wrote: > >> i have two files > > >> ###callbacks.pm### > >> sub foo{ > >> return "foo"; > >> } > > >> sub bar{ > >> return "foo"

Re: import perl module after edit

2007-08-12 Thread Paul Lalli
On Aug 12, 12:17 pm, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > Since the use statement comes after the package statement, the subroutines > are add to that package, not the main. The program will work up to the > subroutine moo, which is not defined. I stand corrected. I didn't realize t

Re: import perl module after edit

2007-08-12 Thread Mr. Shawn H. Corey
Paul Lalli wrote: On Aug 11, 7:18 pm, [EMAIL PROTECTED] (Chris Pax) wrote: i have two files ###callbacks.pm### sub foo{ return "foo"; } sub bar{ return "foo"; } 1; # main.pl## #!/usr/bin/perl #PSUDO CODE# #open callbacks.

Re: Replacing the n'th line with the new line

2007-08-12 Thread Jeff Pang
-Original Message- >From: [EMAIL PROTECTED] >Sent: Aug 11, 2007 9:58 PM >To: beginners@perl.org >Subject: Re: Replacing the n'th line with the new line > >On Aug 9, 6:46 am, [EMAIL PROTECTED] (Chas Owens) wrote: >> On 8/8/07, Jeff Pang <[EMAIL PROTECTED]> wrote: >> snip> perl -pi -e '$i++

Re: import perl module after edit

2007-08-12 Thread Paul Lalli
On Aug 11, 7:18 pm, [EMAIL PROTECTED] (Chris Pax) wrote: > i have two files > > ###callbacks.pm### > sub foo{ > return "foo"; > } > > sub bar{ > return "foo"; > } > > 1; > # > > main.pl## > #!/usr/bin/perl > > #PSUDO CODE# > #ope

Re: my $variable verse $variable

2007-08-12 Thread Jeff Pang
-Original Message- >From: TMC <[EMAIL PROTECTED]> >Sent: Aug 11, 2007 10:41 PM >To: beginners@perl.org >Subject: my $variable verse $variable > >Greetings, >Being new to perl can someone explain why my is in form of variables >and what is the purpose? > Hello, See this good article,whic

Re: import perl module after edit

2007-08-12 Thread Jeff Pang
-Original Message- >From: Chris Pax <[EMAIL PROTECTED]> >Sent: Aug 11, 2007 7:18 PM >To: beginners@perl.org >Subject: import perl module after edit > >i have two files > >###callbacks.pm### >sub foo{ > return "foo"; >} > >sub bar{ > return "foo"; >} >1; >##

Re: Problem with Mechanise...

2007-08-12 Thread mail
On Sat, 2007-08-11 at 23:10 -0400, yitzle wrote: > Please provide more info. Preferably, a short complete program that > duplicates your error. > OK, producing my short script so I can post it helped me to fix it! That is a good practice that I should have done first. I was basically passing an

Re: my $variable verse $variable

2007-08-12 Thread Mr. Shawn H. Corey
Paul Lalli wrote: If you type: use strict; at the top of your program, Perl will force you to "fully qualify" all of your global variables. That is, to name them with their package name in addition to the actual variable name. So the variable $foo in package main must actually be called $main::

Re: my $variable verse $variable

2007-08-12 Thread Paul Lalli
On Aug 11, 10:41 pm, [EMAIL PROTECTED] (Tmc) wrote: > Being new to perl can someone explain why my is in form of variables > and what is the purpose? You should have a read of: http://perl.plover.com/FAQs/Namespaces.html Basically, there are two kinds of variables in Perl. Global variables, whic

Re: qr + shift

2007-08-12 Thread Paul Lalli
On Aug 12, 12:55 am, [EMAIL PROTECTED] (Yitzle) wrote: > Works: > my $t = shift; > my $id = qr($t); > Doesn't work: > my $id = qr(shift); > > Why? Variables interpolate. Function calls don't. Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comman

Re: import perl module after edit

2007-08-12 Thread Mr. Shawn H. Corey
Chris Pax wrote: you see here what i want to happen. what I am doing is writing a new function to the callbacks file, then I want to import the file. the real code fallows the same logic. i tested the read and write stuff, and it works. but when I do it this way, it does not. I had a similar si

Re: my $variable verse $variable

2007-08-12 Thread Mr. Shawn H. Corey
TMC wrote: Greetings, Being new to perl can someone explain why my is in form of variables and what is the purpose? 'my' is used to declare a variable and limit its scope. If you `use strict;` (and you should) you must declare all unqualified variables. #!/usr/bin/perl use strict; use warn

import perl module after edit

2007-08-12 Thread Chris Pax
i have two files ###callbacks.pm### sub foo{ return "foo"; } sub bar{ return "foo"; } 1; # main.pl## #!/usr/bin/perl #PSUDO CODE# #open callbacks.pm #remove 1; #write "sub moo{\n\treturn \"moo\";\n}\n" #write "1;" package ma

my $variable verse $variable

2007-08-12 Thread TMC
Greetings, Being new to perl can someone explain why my is in form of variables and what is the purpose? Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Replacing the n'th line with the new line

2007-08-12 Thread Mr. Shawn H. Corey
[EMAIL PROTECTED] wrote: On Aug 9, 6:46 am, [EMAIL PROTECTED] (Chas Owens) wrote: On 8/8/07, Jeff Pang <[EMAIL PROTECTED]> wrote: snip> perl -pi -e '$i++;s/^.*$/something/ if $i==10' your_file snip There is no need to keep track of the number of lines with a separate variable. Perl already do

Re: Paypal integrations

2007-08-12 Thread mail
On Sat, 2007-08-11 at 19:07 -0500, Mike Blezien wrote: > Hello, > > we have been looking for a Perl written shopping cart that has the PayPal's > Website Payments Pro integrated with it, but haven't found any. There several > PHP carts that do have it, but prefer to stay with Perl. Was hoping so

Re: qr + shift

2007-08-12 Thread Mr. Shawn H. Corey
John W. Krahn wrote: yitzle wrote: Works: my $t = shift; my $id = qr($t); Doesn't work: my $id = qr(shift); Why? perldoc -q "How do I expand function calls in a string" It's because qr is not a function, it's a quote-like operator. Also see `perldoc perlop` and search for 'Quot

Re: Replacing the n'th line with the new line

2007-08-12 Thread uglykidtim
On Aug 9, 6:46 am, [EMAIL PROTECTED] (Chas Owens) wrote: > On 8/8/07, Jeff Pang <[EMAIL PROTECTED]> wrote: > snip> perl -pi -e '$i++;s/^.*$/something/ if $i==10' your_file > > snip > > There is no need to keep track of the number of lines with a separate > variable. Perl already does this with the

Re: Paypal integrations

2007-08-12 Thread Owen
On Sat, 11 Aug 2007 19:07:30 -0500 "Mike Blezien" <[EMAIL PROTECTED]> wrote: > Hello, > > we have been looking for a Perl written shopping cart that has the PayPal's > Website Payments Pro integrated with it, but haven't found any. There several > PHP carts that do have it, but prefer to stay w

Re: qr + shift

2007-08-12 Thread John W. Krahn
yitzle wrote: Works: my $t = shift; my $id = qr($t); Doesn't work: my $id = qr(shift); Why? perldoc -q "How do I expand function calls in a string" John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost a