First perl program

2008-06-18 Thread Jason B
I'm really new to programming and this is my first perl prog. I'm looking for any advice or comments on this script. (I don't want to develop bad habits from the start) Thx. #!/usr/bin/perl #Name:circumf #Date:Jun19/08 #Author:Bornhoft, J #Purpose:to calculate the circumference of a circle pr

Filtered out a IP in a URL

2008-06-18 Thread luke devon
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 a perl script for that purpose . But it seems bit tricky, How can I do this ?

Re: how I extract text information?

2008-06-18 Thread Chas. Owens
On Wed, Jun 18, 2008 at 22:52, Eng. Fadhl Al_Akwaa <[EMAIL PROTECTED]> wrote: > > > Dear Sir > I am beginner with perl and I read many things to do what I want. > I have a text file and I want to extract the column inside the text. the > problem is that the lines is not length equal. > please ho

Re: how I extract text information?

2008-06-18 Thread Rodrick Brown
On Wed, Jun 18, 2008 at 10:52 PM, Eng. Fadhl Al_Akwaa <[EMAIL PROTECTED]> wrote: > > > Dear Sir > I am beginner with perl and I read many things to do what I want. > I have a text file and I want to extract the column inside the text. the > problem is that the lines is not length equal. > please

how I extract text information?

2008-06-18 Thread Eng. Fadhl Al_Akwaa
Dear Sir I am beginner with perl and I read many things to do what I want. I have a text file  and I want  to extract the column inside the text. the problem is that the lines is not length equal. please how could I do it. Regards Fadhl M. Al-Akwaa Biomedical Engineering, PhD Student

Set the parent perl environment vars under windows

2008-06-18 Thread Zhao, Bingfeng
Hello, I know, under perl, if you want to change the environment vars, you should update %ENV, the copy of your process itself. But if all related settings are another batch file, say setting.bat, it's hard to handle it. Simple run this file in your perl script is not enough since perl will just o

Re: from intermediate perl book on closure and callback

2008-06-18 Thread Jenda Krynicky
From: Richard Lee <[EMAIL PROTECTED]> > trying to understand 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}->( ); Because $subs{$_}{GE

Re: from intermediate perl book on closure and callback

2008-06-18 Thread Chas. Owens
On Wed, Jun 18, 2008 at 20:02, Richard Lee <[EMAIL PROTECTED]> wrote: > trying to understand 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}->( ); snip You

Re: populating a hash slice from a filehandle

2008-06-18 Thread Jenda Krynicky
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: populating a hash slice from a filehandle

2008-06-18 Thread Jeff Peng
On Thu, Jun 19, 2008 at 5:50 AM, Bryan R Harris <[EMAIL PROTECTED]> wrote: > > > Given an open filehandle, why don't these two things do the same thing? > > ** > @l2r{"a","b"} = (, ); > $c = ; > because @l2r{...} is a list, right? so the statement above is in a

from intermediate perl book on closure and callback

2008-06-18 Thread Richard Lee
trying to understand 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; use File::Find; sub create_find_callback

populating a hash slice from a filehandle

2008-06-18 Thread Bryan R Harris
Given an open filehandle, why don't these two things do the same thing? ** @l2r{"a","b"} = (, ); $c = ; ** $l2r{"a"} = ; $l2r{"b"} = ; $c = ; ** The first seems to be slurping the whole

Re: Difference between system() and exec() and ``

2008-06-18 Thread Jay Savage
On Wed, Jun 18, 2008 at 4:25 PM, Jenda Krynicky <[EMAIL PROTECTED]> wrote: > Rob Dixon wrote: >> Gunnar Hjalmarsson wrote: >> > Rob Dixon wrote: >> >> Gunnar Hjalmarsson wrote: >> >>> swaroop wrote: >> >> As we know there are 3 ways a system shell command to be executed. >> >> 1

Re: Difference between system() and exec() and ``

2008-06-18 Thread Chas. Owens
On Wed, Jun 18, 2008 at 16:41, Chas. Owens <[EMAIL PROTECTED]> wrote: > On Wed, Jun 18, 2008 at 16:18, <[EMAIL PROTECTED]> wrote: > snip >> A signature line on an email said in effect that the best skill a >> programmer >> can have is to be able to read. I differ. I think that the best skill a >>

Re: Difference between system() and exec() and ``

2008-06-18 Thread Chas. Owens
On Wed, Jun 18, 2008 at 16:18, <[EMAIL PROTECTED]> wrote: snip > A signature line on an email said in effect that the best skill a > programmer > can have is to be able to read. I differ. I think that the best skill a > programmer > can have is the ability to LISTEN. More bad programs and bad proj

Re: Difference between system() and exec() and ``

2008-06-18 Thread Jay Savage
On Wed, Jun 18, 2008 at 4:40 AM, Rob Dixon <[EMAIL PROTECTED]> wrote: > Gunnar Hjalmarsson wrote: >> Rob Dixon wrote: >>> Gunnar Hjalmarsson wrote: swaroop wrote: > > As we know there are 3 ways a system shell command to be executed. > > 1.> $var = system("command"); > 2.>

Re: Difference between system() and exec() and ``

2008-06-18 Thread Jenda Krynicky
Rob Dixon wrote: > Gunnar Hjalmarsson wrote: > > Rob Dixon wrote: > >> Gunnar Hjalmarsson wrote: > >>> swaroop wrote: > > As we know there are 3 ways a system shell command to be executed. > > 1.> $var = system("command"); > 2.> $var = exec("command"); > 3.> $var = `co

RE: Difference between system() and exec() and ``

2008-06-18 Thread Richard.Copits
I mostly lurk, but just to offer a thought.this list seems to be created to help - not to chastise, so why put conditions on a request for help? Why try to insure that the person is "worthy" of help? A signature line on an email said in effect that the best skill a programmer can have is to

Re: Difference between system() and exec() and ``

2008-06-18 Thread Gunnar Hjalmarsson
Rob Dixon wrote: It is entirely possible that the OP had no knowledge of the built in documentation, True. But you can't seriously mean that we should accept that as a persistent state instead of calling his attention to it?? or even that he had already read it, failed to understand it Ye

Re: looping over arrayref of hashes

2008-06-18 Thread Amit Saxena
Hi On the basis of what you have mentioned, I have made a sample code. Let me know if my understanding is different from yours. The Perl Code is copied below :- # cat u.pl #!/usr/bin/perl ##!/u01/app/oracle/product/10.1.0/db_1/perl/bin/perl # # Hi all, I'm in need of a loop, can't seem to fin

Re: looping over arrayref of hashes

2008-06-18 Thread Gunnar Hjalmarsson
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 assigned to $aref: $VAR1 = [ {

Re: looping over arrayref of hashes

2008-06-18 Thread Rodrick Brown
On Wed, Jun 18, 2008 at 12:27 PM, Graeme McLaren < [EMAIL PROTECTED]> 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 whic

looping over arrayref of hashes

2008-06-18 Thread Graeme McLaren
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 assigned to $aref: $VAR1 = [ {'rate' => '1.98',

Re: Removing special character from first line in CSV file

2008-06-18 Thread Dr.Ruud
suyog_linux schreef: > I am new to perl coding and I am working with a CSV file where I have > to remove all the double quotes (") from the first line of the file. > > I need a code that I can embed in a .pl file. Could somebody help me > with this ? Consider Text::CSV_XS -- Affijn, Ruud "Gew

Re: making do work with strict

2008-06-18 Thread Dr.Ruud
beast schreef: > I just want to load variable from config file: > > config.pl: > $basedir = '/home/user/'; > > myprog.pl: > #use strict; > do 'config.pl' or die "can not open config\n"; > # do some stuff here > > the problem is, i have to disable strict in myprog.pl. any other way > to do it? Than

Re: How attach files and send mails on perl????

2008-06-18 Thread Dr.Ruud
"Armin Garcia" schreef: > hi > well i have some problems again, thats my new code: > > > #!/usr/bin/perl -w Get rid of the -w, see perllexwarn. > #Modulos > use MIME::Lite; > use warnings; > use strict; > [...] > $attach_path="/home/agarcia/HoneyClient/To\-Email"; You have "use strict" so th

Re: hash increament

2008-06-18 Thread Dr.Ruud
beast schreef: > What is the reason this following works > $hours{$hour}->{count} + 1 > > but this not works? > $hours{$hour}->{count}++ > > > it actually part of this code: > > $hours{$hour} = { occur => $occur_utc, > delay => $hours{$hour}->{delay} + $delay, >

Re: Difference between system() and exec() and ``

2008-06-18 Thread Dr.Ruud
Rob Dixon schreef: > I think you should talk to the other abusive people who like to > post here and form a separate group. LOL Stop trying to find your way in like this! ;) -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

hash increament

2008-06-18 Thread beast
Hi, What is the reason this following works $hours{$hour}->{count} + 1 but this not works? $hours{$hour}->{count}++ it actually part of this code: $hours{$hour} = { occur => $occur_utc, delay => $hours{$hour}->{delay} + $delay, count =>

Re: Difference between system() and exec() and ``

2008-06-18 Thread Rob Dixon
Gunnar Hjalmarsson wrote: > Rob Dixon wrote: >> Gunnar Hjalmarsson wrote: >>> swaroop wrote: As we know there are 3 ways a system shell command to be executed. 1.> $var = system("command"); 2.> $var = exec("command"); 3.> $var = `command`; What is difference