Re: compare two arrays

2007-06-20 Thread John W. Krahn
Andreas Moroder wrote: Hello, Hello, I have two arrays with strings and I have to find out the differences between this arrays. Is a perl function available that does this ? perldoc -q "How do I compute the difference of two arrays" John -- Perl isn't a toolbox, but a small machine shop

Re: compare two arrays

2007-06-20 Thread Jeff Pang
Andreas Moroder 写道: Hello, I have two arrays with strings and I have to find out the differences between this arrays. Is a perl function available that does this ? Hello, You may try this module: http://search.cpan.org/~typester/Array-Diff-0.04/lib/Array/Diff.pm -- To unsubscribe, e-mail:

compare two arrays

2007-06-20 Thread Andreas Moroder
Hello, I have two arrays with strings and I have to find out the differences between this arrays. Is a perl function available that does this ? Thanks andreas -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Set time period for a statement to execute

2007-06-20 Thread anand kumar
Thank You It worked fine -Anand "Mumia W." <[EMAIL PROTECTED]> wrote: On 06/20/2007 02:07 AM, anand kumar wrote: > Please guide me with some code or documentation for the following problem :- > > I need to set some specific time for a command to execute. [...] > The "alarm" function mig

Re: Unable to run perl script within cron

2007-06-20 Thread Tom Phoenix
On 6/20/07, Ravi Malghan <[EMAIL PROTECTED]> wrote: Hi: I have a script which runs fine when I run it from the shell prompt. My LD_LIBRARY_PATH in the shell is as shown below Somebody told me that if you have to set LD_LIBRARY_PATH and you're not testing libraries, that means that your ld need

Re: [RESOLVED]Unable to run perl script within cron

2007-06-20 Thread Ravi Malghan
I had to set the LD_LIBRARY_PATH in the cron as following 0,5,10,15,20,25,30,35,40,45,50,55 * * * * LD_LIBRARY_PATH=/export/home/netcool/oracle/instantclient_10_2:/usr/arsapi/lib:/usr/local/lib /exp ort/home/netcool/lookForNewRequests.pl - Original Message From: Ravi Malghan <[EMAIL PR

Unable to run perl script within cron

2007-06-20 Thread Ravi Malghan
Hi: I have a script which runs fine when I run it from the shell prompt. My LD_LIBRARY_PATH in the shell is as shown below bash-2.05$ env |grep LD_LIBRARY_PATH LD_LIBRARY_PATH=/export/home/netcool/oracle/instantclient_10_2:/usr/arsapi/lib:/usr/local/lib But the same script when I run from cronta

Re: Running scripts in the Background...

2007-06-20 Thread yitzle
On 6/20/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Steve Pittman wrote: snip man nohup John Rather than doing a Perl fix, I think you can detach the 'screen' and reattach it later, so the script doesn't see anything happening. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

Re: the Database is not updated

2007-06-20 Thread Aruna Goke
Chas Owens wrote: On 6/20/07, Paul Lalli <[EMAIL PROTECTED]> wrote: snip This might not be necessary for the RDMS you use, but I generally end my database-driven scripts with this block: END { if ($?) { print "Exiting with error, rolling back data!\n"; $dbh->rollback(); }

Re: the Database is not updated

2007-06-20 Thread Aruna Goke
Chas Owens wrote: On 6/20/07, Paul Lalli <[EMAIL PROTECTED]> wrote: snip This might not be necessary for the RDMS you use, but I generally end my database-driven scripts with this block: END { if ($?) { print "Exiting with error, rolling back data!\n"; $dbh->rollback(); }

Re: Running scripts in the Background...

2007-06-20 Thread John W. Krahn
Steve Pittman wrote: I have a perl script that I want to leave running after I close my terminal session...it's a tcpip listener... When i run the job in background mode and exit the term session...it terminates Any thoughts?thanks in advance..Steve! $ killMsgRcv.pl 9997 [Server killMsgRc

Running scripts in the Background...

2007-06-20 Thread Steve Pittman
I have a perl script that I want to leave running after I close my terminal session...it's a tcpip listener... When i run the job in background mode and exit the term session...it terminates Any thoughts?thanks in advance..Steve! $ killMsgRcv.pl 9997 [Server killMsgRcv.pl accepting clients]

Re: parse mime email

2007-06-20 Thread Tom Allison
Check the bugs on Email::MIME. IIRC there's an error when the response is '' which is legal but not handled by the code. I submitted a bug a couple of years ago and I don't believe it's been fixed. I found MIME::Tools to be the absolute best in parsing MIME content in it's ability to giv

Re: the Database is not updated

2007-06-20 Thread Chas Owens
On 6/20/07, Paul Lalli <[EMAIL PROTECTED]> wrote: snip This might not be necessary for the RDMS you use, but I generally end my database-driven scripts with this block: END { if ($?) { print "Exiting with error, rolling back data!\n"; $dbh->rollback(); } else { prin

Re: the Database is not updated

2007-06-20 Thread Paul Lalli
On Jun 20, 2:23 pm, [EMAIL PROTECTED] (Aruna Goke) wrote: > Can someone put me thru this? > > when I run the script..it bring no error.. That's because you never asked it to give you any errors. That's something of a Perl trait - it generally doesn't tell you anything's wrong unless you ask it to

Re: the Database is not updated

2007-06-20 Thread Chas Owens
On 6/20/07, Aruna Goke <[EMAIL PROTECTED]> wrote: snip $sth->execute($x[2], $x[5], $x[4], $x[6]); snip I would also change this line to $sth->execute(@x[2,5,4,6]); But that is just because I am lazy. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTE

Re: the Database is not updated

2007-06-20 Thread Chas Owens
On 6/20/07, Boyle, Christopher <[EMAIL PROTECTED]> wrote: Dumb question, does mysql need an explicit commit? The DBI does a commit after every statement unless you pass AutoCommit => 0 during the connect call. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: the Database is not updated

2007-06-20 Thread Chas Owens
On 6/20/07, Aruna Goke <[EMAIL PROTECTED]> wrote: snip $dbh = DBI->connect($data_source, $user, $pass); snip change this line to $dbh = DBI->connect( $data_source, $user, $pass { RaiseError => 1 } ); And the code will raise an error telling you what is wrong with the SQL

RE: the Database is not updated

2007-06-20 Thread Boyle, Christopher
Dumb question, does mysql need an explicit commit? -Original Message- From: Aruna Goke [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 20, 2007 2:23 PM To: beginners@perl.org; [EMAIL PROTECTED] Subject: the Database is not updated Can someone put me thru this? when I run the script..it

the Database is not updated

2007-06-20 Thread Aruna Goke
hi all, Can someone put me thru this? when I run the script..it bring no error.. however, the table radacct is not updated. what have i done wrong. Goksie #!/usr/bin/perl use strict; use warnings; use DBI; my ($fn, @x); #define the file $fn = 'lost.csv'; $/ = "\n"; #prepare a database conn

the Database is not updated

2007-06-20 Thread Aruna Goke
Can someone put me thru this? when I run the script..it bring no error.. however, the table radacct is not updated. what have i done wrong. Goksie #!/usr/bin/perl use strict; use warnings; use DBI; my ($fn, @x); #define the file $fn = 'lost.csv'; $/ = "\n"; #prepare a database connection

Re: Trouble installing with CPAN

2007-06-20 Thread Mumia W.
On 06/20/2007 08:40 AM, yitzle wrote: I took down the firewall and got the same results. Could not fetch authors/id/K/KA/KASEI/Crypt-Simple-0.06.tar.gz Giving up on '/home/Admin/.cpan/sources/authors/id/K/KA/KASEI/Crypt-Simple-0.06.tar.gz' Note: Current database in memory was generated on Sat,

Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread Chas Owens
On 6/20/07, oryann9 <[EMAIL PROTECTED]> wrote: snip Also noticed I could use binary & and | $ perl -le 'print "hello" & "X";' [EMAIL PROTECTED] $ perl -le 'print "hello" | "X";' x}||⌂ but these were not decrypted. Why not? There is a reason I used xor (grin). The other operators do

Re: Problems with arrays

2007-06-20 Thread Prabu Ayyappan
Hi, Hope this is what you are expecting. #!/usr/bin/perl -w ($old_header,$old_atoms,$old_bonds) = mol2_read('prabu'); print "@{$old_header} \n @{$old_atoms} \n @{$old_bonds}"; sub mol2_read { @mol2_header = ('prabu1','prabu12'); @mol2_atoms = ('prabu2'); @mol2_bonds = ('pr

Re: Problems with arrays

2007-06-20 Thread Prabu Ayyappan
Hi, Hope this is what you are expecting. #!/usr/bin/perl -w ($old_header,$old_atoms,$old_bonds) = mol2_read('prabu'); print "@{$old_header} \n @{$old_atoms} \n @{$old_bonds}"; sub mol2_read { @mol2_header = ('prabu1','prabu12'); @mol2_atoms = ('prabu2'); @mol2_bonds = ('pr

Re: Problems with arrays

2007-06-20 Thread Prabu Ayyappan
Hi, Hope this is what you are expecting. #!/usr/bin/perl -w ($old_header,$old_atoms,$old_bonds) = mol2_read('prabu'); print "@{$old_header} \n @{$old_atoms} \n @{$old_bonds}"; sub mol2_read { @mol2_header = ('prabu1','prabu12'); @mol2_atoms = ('prabu2'); @mol2_bonds = ('pr

Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread Chas Owens
On 6/20/07, oryann9 <[EMAIL PROTECTED]> wrote: snip > > my $plaintext = do { local $/ = undef; <> }; > > my $pad = "X" x length $plaintext; > > > > my $encryptedtext = $plaintext ^ $pad; snip I like it to, but dont understand how it is encrypting. Will you kindly expalin? $plaintext is t

Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread oryann9
> > > > > > #!/usr/bin/perl > > > > > > > > use strict; > > > > use warnings; > > > > > > > > my $plaintext = do { local $/ = undef; <> }; > > > > my $pad = "X" x length $plaintext; > > > > > > > > my $encryptedtext = $plaintext ^ $pad; > > > > my $decryptedtext = $encryptedtext ^ $pad; > >

Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread oryann9
--- oryann9 <[EMAIL PROTECTED]> wrote: > > > > #!/usr/bin/perl > > > > > > use strict; > > > use warnings; > > > > > > my $plaintext = do { local $/ = undef; <> }; > > > my $pad = "X" x length $plaintext; > > > > > > my $encryptedtext = $plaintext ^ $pad; > > > my $decryptedtext = $encrypte

Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread oryann9
> > #!/usr/bin/perl > > > > use strict; > > use warnings; > > > > my $plaintext = do { local $/ = undef; <> }; > > my $pad = "X" x length $plaintext; > > > > my $encryptedtext = $plaintext ^ $pad; > > my $decryptedtext = $encryptedtext ^ $pad; > > print > "plaintext:\n$plaintext\n\nencrypted

Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread Chas Owens
On 6/20/07, yitzle <[EMAIL PROTECTED]> wrote: > Without more information about why you want to encrypt something we > can give no good advice; so here's some bad advice > > #!/usr/bin/perl > > use strict; > use warnings; > > my $plaintext = do { local $/ = undef; <> }; > my $pad = "X" x length $p

Re: Alternatives to highly nested hashes

2007-06-20 Thread Mathew
Rob Dixon wrote: > Mathew Snyder wrote: >> It looks like an object is what I want. Am I correct? Suppose I need >> to work >> with a bit of data that actually has 11 attributes. This would be an >> object of >> another type. However, I need to manipulate pieces of it >> differently. So I'm >>

Re: find2perl output to array

2007-06-20 Thread Randal L. Schwartz
> "Matt" == Matt <[EMAIL PROTECTED]> writes: Matt> #!/usr/bin/perl use File::Finder; # in the CPAN Matt> $cuid = "aef"; Matt> $directory = "EOM033107"; Matt> $smallcuid = lc $cuid; my @result = File::Finder->type('f')->name(qr/^DATA.*\.zip\z/)->in( '/home/ftpuser/'.$smallcuid.'/flexvaul

Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread yitzle
Without more information about why you want to encrypt something we can give no good advice; so here's some bad advice #!/usr/bin/perl use strict; use warnings; my $plaintext = do { local $/ = undef; <> }; my $pad = "X" x length $plaintext; my $encryptedtext = $plaintext ^ $pad; my $decry

Re: parse mime email

2007-06-20 Thread Tom Phoenix
On 6/20/07, Tony marquis <[EMAIL PROTECTED]> wrote: I'm trying to read the body and the attachment in a mime message. I keep getting the folling error. Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Email/MIME/ContentType.pm line 24. That means that at or near line 24 o

Re: Trouble installing with CPAN

2007-06-20 Thread Tom Phoenix
On 6/20/07, yitzle <[EMAIL PROTECTED]> wrote: I tried to install Crypt::Simple using the CPAN shell Can you install other modules using the CPAN shell? Can you install this module without the CPAN shell? It seems to be available here: http://search.cpan.org/CPAN/authors/id/K/KA/KASEI/Cryp

Re: Reading a particular line from a file

2007-06-20 Thread Mumia W.
On 06/20/2007 06:42 AM, Nath, Alok (STSD) wrote: Hi, Is it possible to read a particular line by line number ? For e.g reading line 3 from a file. I don't want to read each line and count. Thanks Alok The module Tie::File makes this easy. However, you should probably

Re: Simple Encryption - what function/module could I use?

2007-06-20 Thread Chas Owens
On 6/20/07, yitzle <[EMAIL PROTECTED]> wrote: What function/module (I prefer built in functions...) is there that I can use to do some simple/basic reversable (opposed to crypt()'s one way) encryption? I want to be able to encrypt/decrypt a textfile. -- To unsubscribe, e-mail: [EMAIL PROTECTED]

RE: Inter-thread communications

2007-06-20 Thread Bob McConnell
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of zentara > Sent: Wednesday, June 20, 2007 8:13 AM > To: beginners@perl.org > Subject: Re: Inter-thread communications > > On Tue, 19 Jun 2007 15:44:18 -0400, [EMAIL PROTECTED] ("Bob McConnell") > wrote:

Re: add comment to the begin of a line

2007-06-20 Thread Tom Phoenix
On 6/20/07, Isnard Delacoste Jaquet Junior <[EMAIL PROTECTED]> wrote: I have a simple question (hard for me that don't know perl though): How do I search for a line and when found insert a comment in the beginning of it? Perl's comments run from the pound sign ("#") to end-of-line, so a commen

parse mime email

2007-06-20 Thread TONY MARQUIS
I'm trying to read the body and the attachment in a mime message. I keep getting the folling error. Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Email/MIME/ContentType.pm line 24. #!/usr/bin/perl -w use Net::POP3; use Email::MIME; my ($mail_server, $username, $passwo

add comment to the begin of a line

2007-06-20 Thread Isnard Delacoste Jaquet Junior
Hello, I have a simple question (hard for me that don't know perl though): How do I search for a line and when found insert a comment in the beginning of it? If more info is needed let me know please. Best regards, Isnard -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

parse mime email

2007-06-20 Thread Tony marquis
I'm trying to read the body and the attachment in a mime message. I keep getting the folling error. Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Email/MIME/ContentType.pm line 24. #!/usr/bin/perl -w use Net::POP3; use Email::MIME; my ($mail_server, $username, $pass

RE: Reading a particular line from a file

2007-06-20 Thread Andrew Curry
But that still reads the entire file to that point, You can use seek if you know the number of chars on a line. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 20 June 2007 13:53 To: beginners@perl.org Subject: Re: Reading a particular line from a file On 20 J

RE: Problems with arrays

2007-06-20 Thread Andrew Curry
You could do it a couple of ways the way I would go about it is My(@arr1,@arr2,@arr3); mol2_read($opts{m},[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]); sub mol2_read { My($opt_m,$arr1,$arr2,$arr3)[EMAIL PROTECTED]; # # code to do what you want with the above # return; } -O

Re: Reading a particular line from a file

2007-06-20 Thread todeepaksahoo
On 20 Jun, 16:42, [EMAIL PROTECTED] (Alok Nath) wrote: > Hi, > Is it possible to read a particular line by line number ? > > For e.g reading line 3 from a file. > > I don't want to read each line and count. > > Thanks > Alok You can do below to print the 3rd line. open FIL

Problems with arrays

2007-06-20 Thread [EMAIL PROTECTED]
Hi everybody, I got a problem with handling sub-routines and arrays. Here is an example of the code: #!/usr/bin/perl -w (@old_header,@old_atoms,@old_bonds) = mol2_read($opts{m}); sub mol2_read { return ([EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]); } Ok, now the problem: If I

Re: Trouble installing with CPAN

2007-06-20 Thread yitzle
I took down the firewall and got the same results. Could not fetch authors/id/K/KA/KASEI/Crypt-Simple-0.06.tar.gz Giving up on '/home/Admin/.cpan/sources/authors/id/K/KA/KASEI/Crypt-Simple-0.06.tar.gz' Note: Current database in memory was generated on Sat, 05 May 2007 21:09:57 GMT On 6/20/07, y

Trouble installing with CPAN

2007-06-20 Thread yitzle
I tried to install Crypt::Simple using the CPAN shell It failed at downloading the module multiple times from multiple servers. I got: Please check, if the URLs I found in your configuration file (ftp://CPAN.mirror.rafal.ca/pub/CPAN/, ftp://cpan.sunsite.ualberta.ca/pub/CPAN/, ftp://ftp.nrc.ca/pub

Re: Reading a particular line from a file

2007-06-20 Thread Paul Lalli
On Jun 20, 7:42 am, [EMAIL PROTECTED] (Alok Nath) wrote: > Is it possible to read a particular line by line number ? > > For e.g reading line 3 from a file. > > I don't want to read each line and count. You don't have to count. Perl counts for you. The current line number

Re: Reading a particular line from a file

2007-06-20 Thread Ken Foskey
On Wed, 2007-06-20 at 17:12 +0530, Nath, Alok (STSD) wrote: > Hi, > Is it possible to read a particular line by line number ? > > For e.g reading line 3 from a file. > > I don't want to read each line and count. No and yes. If it is genuine new random data then no. If it is fi

Reading a particular line from a file

2007-06-20 Thread Nath, Alok (STSD)
Hi, Is it possible to read a particular line by line number ? For e.g reading line 3 from a file. I don't want to read each line and count. Thanks Alok -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Alternatives to highly nested hashes

2007-06-20 Thread Rob Dixon
Mathew Snyder wrote: It looks like an object is what I want. Am I correct? Suppose I need to work with a bit of data that actually has 11 attributes. This would be an object of another type. However, I need to manipulate pieces of it differently. So I'm guessing I would create an object thus

Re: Alternatives to highly nested hashes

2007-06-20 Thread Mumia W.
On 06/20/2007 05:40 AM, Mathew Snyder wrote: It looks like an object is what I want. Am I correct? As always, it depends. Suppose I need to work with a bit of data that actually has 11 attributes. This would be an object of another type. However, I need to manipulate pieces of it differen

Re: Alternatives to highly nested hashes

2007-06-20 Thread Mathew Snyder
It looks like an object is what I want. Am I correct? Suppose I need to work with a bit of data that actually has 11 attributes. This would be an object of another type. However, I need to manipulate pieces of it differently. So I'm guessing I would create an object thusly: sub objectname {

Re: Alternatives to highly nested hashes

2007-06-20 Thread Rob Dixon
Mathew Snyder wrote: I'm probably going to be doing some work with data that would, based on what I already know of Perl, require me to create something along the lines of a HoHoHoHoHoHoHoHoH...not exactly representative but you get the idea. Is there a way to handle data with a lot of attribut

Re: bug in perl or in my head ;-)

2007-06-20 Thread Martin Barth
Thank you I learnt a lot! Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Alternatives to highly nested hashes

2007-06-20 Thread Mathew Snyder
I'm probably going to be doing some work with data that would, based on what I already know of Perl, require me to create something along the lines of a HoHoHoHoHoHoHoHoH...not exactly representative but you get the idea. Is there a way to handle data with a lot of attributes other than creating a

Re: Set time period for a statement to execute

2007-06-20 Thread Mumia W.
On 06/20/2007 02:07 AM, anand kumar wrote: Please guide me with some code or documentation for the following problem :- I need to set some specific time for a command to execute. [...] The "alarm" function might help you: At a command prompt, type "perldoc -f alarm" -- To unsubscr

RE: How to get the values

2007-06-20 Thread Nath, Alok (STSD)
Thanks .It serves the purpose. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 20, 2007 12:42 PM To: beginners@perl.org Cc: Nath, Alok (STSD) Subject: Re: How to get the values Nath, Alok (STSD) wrote: > Hi, > I have a file from which I have to p

Re: How to get the values

2007-06-20 Thread Rob Dixon
Nath, Alok (STSD) wrote: Hi, I have a file from which I have to pick a line like this and get the values of Par, Default and RootOnly. Par=som Default=yes RootOnly=no Shared=force I am trying something like below.But the code is becoming long. Anything simpli

Set time period for a statement to execute

2007-06-20 Thread anand kumar
Please guide me with some code or documentation for the following problem :- I need to set some specific time for a command to execute. For example, If I am opening a very large file and it takes me more than 3 to 4 seconds then my code should be able to quit the program or kill the process