Re: Compressing multiple columns into one

2008-06-19 Thread Emen Zhao
Hello, How about this? my @test = qw(10 20 30 40 50); splice @test, 1, 3, $test[1]+$test[2]+$test[3]; print "@test"; Thanks, --Emen On Thu, Jun 19, 2008 at 4:05 PM, Jean-Rene David <[EMAIL PROTECTED]> wrote: > Hi, > > A little problem I encountered recently. > > I have an array of integers and

Re: Perl coding - Reinventing the Wheel ?

2008-06-19 Thread Amit Saxena
I agree with you as well on this ! On Thu, Jun 19, 2008 at 10:37 PM, Chas. Owens <[EMAIL PROTECTED]> wrote: > Build from scratch to teach yourself about things, but use the wheels > already invented for real/production work. > > -- > Chas. Owens > wonkden.net > The most important skill a programm

Re: how to install SOAP::lite on windows

2008-06-19 Thread sisyphus
On Jun 20, 4:13 am, [EMAIL PROTECTED] (Xue Li) wrote: > Hello all, > > I am trying to install SOAP::lite on my windows using > > perl -MCPAN -e "install SOAP::Lite" > > But it stuck at > >  t/SOAP/Transport/HTTP/CGI > I get the same (also on Win32). By installing some 'print "G

Re: problem with printing

2008-06-19 Thread Rob Dixon
dakin999 wrote: > > I have following code which works ok. It does following: > > 1. reads data from a input file > 2. puts the data into seperate variables in a array This is where you are getting confused. The data should be /either/ in separate variables /or/ in an array. See below. > 3. read

Re: problem with printing

2008-06-19 Thread yitzle
On Thu, Jun 19, 2008 at 1:57 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Do more simple and whit out numbers, some times the $1 .. are special > vars > > while () { > ($v1,$v2,$v3,$v4)=split(/,/,$_); > print "$v1\n"; > print "$v2\n"; > print "$v3\n"; > print "$v4\n"; > print "\n";

Re: Writing output to a file

2008-06-19 Thread [EMAIL PROTECTED]
On Jun 18, 7:12 pm, [EMAIL PROTECTED] (Dakin999) wrote: > Hi, I am trying to write the script myself and now stuck at some > thiong that I am pretty sure have been done by others. Any help will > be significant. > > Ok, I have created an array and now I want to read from this array the > elements a

Re: populating a hash slice from a filehandle

2008-06-19 Thread John W. Krahn
Bryan R Harris wrote: John W. Krahn wrote: Bryan R Harris wrote: Jenda Krynicky wrote: Context. The returns a single line in scalar context and a list of all lines in a list context. And there is no such thing as a two-item-list context. So in the first case the assignment to @l2r{"a","b

Re: syntax for or {multiple; statements;}?

2008-06-19 Thread John W. Krahn
boole wrote: Hello sorry for this lame question but I can't search it becuase I don't know how to explain it in searchable terms, what I did search turned up nothing useful. How can you execute multiple statements in Perl when perl expects one statement? Like I thought this would work: $dbh =

syntax for or {multiple; statements;}?

2008-06-19 Thread boole
Hello sorry for this lame question but I can't search it becuase I don't know how to explain it in searchable terms, what I did search turned up nothing useful. How can you execute multiple statements in Perl when perl expects one statement? Like I thought this would work: $dbh = DBI->connect("D

Re: problem with printing

2008-06-19 Thread [EMAIL PROTECTED]
On Jun 19, 5:10 am, [EMAIL PROTECTED] (Dakin999) wrote: > Hi, > > I have following code which works ok. It does following: > > 1. reads data from a input file > 2. puts the data into seperate variables in a array > 3. reads from this array and prints out to another file > > It works except that it

Re: Mailing List Replies?

2008-06-19 Thread Michelle Konzack
Am 2008-06-16 16:53:27, schrieb Rick Bragg: > Just curious, > > Is there a reason why the reply-to on this mailing list is set to go > back to the poster and not back to the list? I think its best for a > list like this to keep all the messages on the list, so when I reply, I > need to manually p

Re: populating a hash slice from a filehandle

2008-06-19 Thread Bryan R Harris
> Bryan R Harris wrote: >>> From: Bryan R Harris <[EMAIL PROTECTED]> Given an open filehandle, why don't these two things do the same thing? ** @l2r{"a","b"} = (, ); $c = ; ** $l2r{"a"

Compressing multiple columns into one

2008-06-19 Thread Jean-Rene David
Hi, A little problem I encountered recently. I have an array of integers and two indexes within that array. I need to get another array identical to the first one, except that all cells between the two indexes (inclusive) must be compressed to one column which is the sum of the originals cells.

Re: Compressing multiple columns into one

2008-06-19 Thread Jean-Rene David
* Paul Lalli [2008.06.19 13:52]: > On Jun 19, 11:41 am, [EMAIL PROTECTED] (Jean-Rene David) wrote: > > I have an array of integers and two indexes within > > that array. I need to get another array identical > > to the first one, except that all cells between > > the two indexes (inclusive) must be

Re: File search program!

2008-06-19 Thread John W. Krahn
Gunwant Singh wrote: Hi all, Hello, I wrote a code that can search any file/folder on a PC given that you must give the file name with its extension. The code works fine. Any suggestions to make the code better or faster. Here is the code:

how to install SOAP::lite on windows

2008-06-19 Thread Xue Li
Hello all, I am trying to install SOAP::lite on my windows using perl -MCPAN -e "install SOAP::Lite" But it stuck at t/SOAP/Transport/HTTP/CGI Is there something wrong? Thanks. -- Xue, Li Bioinformatics and Computational Biology program Material Science Iowa State Univ

Re: Compressing multiple columns into one

2008-06-19 Thread John W. Krahn
Jean-Rene David wrote: Hi, Hello, A little problem I encountered recently. I have an array of integers and two indexes within that array. I need to get another array identical to the first one, except that all cells between the two indexes (inclusive) must be compressed to one column which i

Re: File search program!

2008-06-19 Thread Gunwant Singh
Paul, I did not rewrite any windows program but just thought of coding such a program. That code which you re-wrote was good actually, except for the backslash which you missed , as in the following: find(\&Wanted, '\/'); I will be re-writing the same code without the File::Find module. I

Re: from intermediate perl book on closure and callback

2008-06-19 Thread John W. Krahn
Richard Lee wrote: trying to understand closure perldoc -q closure and callback(bit over my head but) while I think i grasp most of the ideas from below program.. I don't think I understand why ( ) is needed in my $sum = $subs{$_}{GETTER}->( ); #!/usr/bin/perl use warnings; use strict

Re: Compressing multiple columns into one

2008-06-19 Thread Paul Lalli
On Jun 19, 11:41 am, [EMAIL PROTECTED] (Jean-Rene David) wrote: > A little problem I encountered recently. > > I have an array of integers and two indexes within > that array. I need to get another array identical > to the first one, except that all cells between > the two indexes (inclusive) must

Re: Writing output to a file

2008-06-19 Thread yitzle
On Wed, Jun 18, 2008 at 8:12 PM, dakin999 <[EMAIL PROTECTED]> wrote: > Hi, I am trying to write the script myself and now stuck at some > thiong that I am pretty sure have been done by others. Any help will > be significant. > > Ok, I have created an array and now I want to read from this array the

Re: populating a hash slice from a filehandle

2008-06-19 Thread John W. Krahn
Bryan R Harris wrote: From: Bryan R Harris <[EMAIL PROTECTED]> Given an open filehandle, why don't these two things do the same thing? ** @l2r{"a","b"} = (, ); $c = ; ** $l2r{"a"} = ; $l2r{"b"} = ; $c = ;

Re: problem with printing

2008-06-19 Thread yitzle
Always: use strict; use warnings; On Thu, Jun 19, 2008 at 6:10 AM, dakin999 <[EMAIL PROTECTED]> wrote: > Hi, > > I have following code which works ok. It does following: > > 1. reads data from a input file > 2. puts the data into seperate variables in a array > 3. reads from this array and prints

Re: File search program!

2008-06-19 Thread Paul Lalli
On Jun 19, 12:16 pm, [EMAIL PROTECTED] (Gunwant Singh) wrote: > Hi all, > > I wrote a code that can search any file/folder on a PC given that you > must give the file name with its extension. > The code works fine. Any suggestions to make the code better or faster. > Here is the code: > ---

Re: Perl coding - Reinventing the Wheel ?

2008-06-19 Thread Gunwant Singh
Thank you very much! That answers my question. Cheers, Gunwant Singh. Chas. Owens wrote: Build from scratch to teach yourself about things, but use the wheels already invented for real/production work. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to

Re: looping over arrayref of hashes

2008-06-19 Thread Narthring
On Jun 18, 11:27 am, [EMAIL PROTECTED] (Graeme McLaren) wrote: > Hi all, I'm in need of a loop, can't seem to find what I'm looking for > online.  I want to loop over this array ref inserting each hash value into > the DB at each iteration.I've got the following data structure which is > assigne

Writing output to a file

2008-06-19 Thread dakin999
Hi, I am trying to write the script myself and now stuck at some thiong that I am pretty sure have been done by others. Any help will be significant. Ok, I have created an array and now I want to read from this array the elements and put them in a LDIF format. Something like this: dn: uid=xxx,cn=

Re: Perl coding - Reinventing the Wheel ?

2008-06-19 Thread Chas. Owens
Build from scratch to teach yourself about things, but use the wheels already invented for real/production work. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. On Jun 19, 2008, at 12:53, Gunwant Singh wrote: Hi all, I have a dilmma for the

Perl coding - Reinventing the Wheel ?

2008-06-19 Thread Gunwant Singh
Hi all, I have a dilmma for the last few days. I read an article about '10 things every Perl hacker should know' (available here: http://articles.techrepublic.com.com/5100-10878_11-6077064.html). And I was concerned about the point that says NOT to reinvent the wheel. I was just thinking to

Re: Argument for perl script

2008-06-19 Thread Nayab
On Jun 19, 4:55 pm, [EMAIL PROTECTED] (Rajnikant) wrote: > Hope this snipet will help you :). > > # Use :Perl -w test_argc.pl --name Irfan > > use strict; > use warnings; > > # Get args > my @argv = @ARGV; > > #get args cnt > my $argc = @ARGV; > > my $icnt = 0; > > if($argc != 0) > { >     for($icn

problem with printing

2008-06-19 Thread dakin999
Hi, I have following code which works ok. It does following: 1. reads data from a input file 2. puts the data into seperate variables in a array 3. reads from this array and prints out to another file It works except that it prints the same record 4 times. I can see I have missed some thing in m

Re: Capture URL parameter

2008-06-19 Thread Brad Baxter
On Jun 17, 4:50 am, [EMAIL PROTECTED] (Luke Devon) wrote: > Dear Friends > > I am going to capture some values/parameters which are comes trough URL. like > Client_IP , domain name .etc. But i have no idea how it would be done by > perl. Here i am going to use bcoz this program based on squid

File search program!

2008-06-19 Thread Gunwant Singh
Hi all, I wrote a code that can search any file/folder on a PC given that you must give the file name with its extension. The code works fine. Any suggestions to make the code better or faster. Here is the code: --

Compressing multiple columns into one

2008-06-19 Thread Jean-Rene David
Hi, A little problem I encountered recently. I have an array of integers and two indexes within that array. I need to get another array identical to the first one, except that all cells between the two indexes (inclusive) must be compressed to one column which is the sum of the originals cells.

Re: populating a hash slice from a filehandle

2008-06-19 Thread Bryan R Harris
> From: Bryan R Harris <[EMAIL PROTECTED]> >> Given an open filehandle, why don't these two things do the same thing? >> >> ** >> @l2r{"a","b"} = (, ); >> $c = ; >> >> ** >> $l2r{"a"} = ; >> $l2r{"b"} = ; >> $c = ; >> >> **

Re: problem with Mime::Lite

2008-06-19 Thread Matthew Whipple
On Thu, 2008-06-19 at 13:08 +0300, Malka Cymbalista wrote: > Thanks for your reply. We tried adding Return-Path but it doesn't get > overwritten and when I look in the Mime headers I see that the Return-Path is > still the user that runs the web process. Is it not getting changed or is your

Re: Filtered out a IP in a URL

2008-06-19 Thread Jay Savage
On Thu, Jun 19, 2008 at 1:20 AM, luke devon <[EMAIL PROTECTED]> wrote: > Dear Friends, > > In squid URL-rewriting , I wanted to add some third party > parameters to the URL and wanted to filtered out IP which assigned for > client ( Client -IP ). Rather than having a shell script , I supposed to do

Re: how I extract text information?

2008-06-19 Thread Eng. Fadhl Al_Akwaa
Dear Sir This is sample of my data. I need to extract the yellow color column. http://rapidshare.de/files/39766858/cluster1.xls.html Regards Fadhl M. Al-Akwaa Biomedical Engineering, PhD Student --- On Wed, 6/18/08, Chas. Owens <[EMAIL PROTECTED]> wrote: From: Chas. Owens <[EMAIL PROTECTED]> S

RE: Argument for perl script

2008-06-19 Thread Irfan.Sayed
Thanks a lot for all response. Regards Irfan. -Original Message- From: Mimi Cafe [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2008 6:34 PM To: beginners@perl.org Subject: Re: Argument for perl script You may have to parse @ARGV manually depending on how arguments are passed to yo

Re: Argument for perl script

2008-06-19 Thread Mimi Cafe
You may have to parse @ARGV manually depending on how arguments are passed to your script. For instance, if you script is run as follows: perl ack --name foo --pkg bar -relno 1234 then @ARGV will contain "--name, foo, --pkg, bar, -relno, 1234," and you will have to parse the list for the values you

RE: Argument for perl script

2008-06-19 Thread Rajnikant
Hope this snipet will help you :). # Use :Perl -w test_argc.pl --name Irfan use strict; use warnings; # Get args my @argv = @ARGV; #get args cnt my $argc = @ARGV; my $icnt = 0; if($argc != 0) { for($icnt = 0;$icnt < $argc;$icnt++) { if($argv[$icnt] eq "--name") {

Argument for perl script

2008-06-19 Thread Irfan.Sayed
Hi All, I am using @ARGV variable to record the argument passed to my Perl script. Now the requirement is that if I don't pass any argument to Perl script then it should show me following such output. Perl ack Usage: ack -name -pkg -relno

Re: problem with Mime::Lite

2008-06-19 Thread Malka Cymbalista
Thanks for your reply. We tried adding Return-Path but it doesn't get overwritten and when I look in the Mime headers I see that the Return-Path is still the user that runs the web process. We also tried setting the Reply-To field and I see in the mime header that it was changed to what we wa

Re: problem with Mime::Lite

2008-06-19 Thread Dermot
2008/6/19 Malka Cymbalista <[EMAIL PROTECTED]>: > We are running perl 5.8.5 and apache 2.2.6 on a Linux machine. > One of our web pages is a form that allows people to send email. The script > that drives the form is a perl script and it uses Mime::Lite to send the > email. > The script create

Re: problem with Mime::Lite

2008-06-19 Thread Rob Coops
I believe that that can be done by filling the reply-to variable of Mime::Lite this should make the mail server send any reply to the email address specified there. I never tested that so I am not making any promisses but it should work as far as I recall... On Thu, Jun 19, 2008 at 10:51 AM, Malk

problem with Mime::Lite

2008-06-19 Thread Malka Cymbalista
We are running perl 5.8.5 and apache 2.2.6 on a Linux machine. One of our web pages is a form that allows people to send email. The script that drives the form is a perl script and it uses Mime::Lite to send the email. The script creates the entire mail message including the From: and To:

Re: First perl program

2008-06-19 Thread Dr.Ruud
Thomas Bätzler schreef: > #!/usr/bin/perl -w Read perllexwarn. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: First perl program

2008-06-19 Thread Thomas Bätzler
Hi, Jason B <[EMAIL PROTECTED]> wrote: > I'm really new to programming and this is my first perl prog. > I'm looking for any advice or comments on this script. Enable warnings and "use strict;". That'll help you to write better code. > > #!/usr/bin/perl #!/usr/bin/perl -w use strict; > #

Re: First perl program

2008-06-19 Thread Dr.Ruud
"Jason B" schreef: > #!/usr/bin/perl Missing: use strict; use warnings; > #Name:circumf > #Date:Jun19/08 > #Author:Bornhoft, J > #Purpose:to calculate the circumference of a circle > > print "Hi. I'm going to help you calculate the circumference of a > circle\n"; Alternative: print <

Re: First perl program

2008-06-19 Thread Rob Coops
Hi Jason, To start with you are going to get quite a few replies that will tell you to use strict and enable warnings because that is what good perl programers do. :-) #!/usr/bin/perl use strict; use warnings; #Name:circumf Strict basically forces you to scope your variables, there is a lot of