AW: Kindly explain special variable $|

2009-05-27 Thread Thomas Bätzler
sanket vaidya asked: > It would be great if some of you write a simple code which has two > different outputs for $| = 0 & $| = 1 to demonstrate the difference. Try this with different values for $| #!/usr/bin/perl -w use strict; $| = 1; for ( 1..20 ){ print "."; warn "!" unless $i % 5;

Kindly explain special variable $|

2009-05-27 Thread sanket vaidya
Hi, Perldoc for $| is as below: 1. If set to nonzero, forces a flush right away and after every write or print on the currently selected output channel. Default is 0 (regardless of whether the channel is really buffered by the system or not; $| tells you only whether you've asked Perl expli

Re: Parsing TXT document and output to XML

2009-05-27 Thread Stephen Reese
On Wed, May 27, 2009 at 6:27 PM, Stephen Reese wrote: > List, > > I've been working on a method to parse a PDF or TXT document and > output the results to XML over at Experts Exchange. > http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_24439630.html > > You may view the attac

Re: suppressing Use of uninitialized value in pattern match (m//)

2009-05-27 Thread John W. Krahn
admin2 wrote: How can I suppress the first "Use of uninitialized value in pattern match (m//)" warning message. code and output are below. code # cat ./fix_archive.pl #!/usr/bin/perl use warnings; use strict; my @files = <*> unless /.mbox^/; That line reads as: my @files = <

suppressing Use of uninitialized value in pattern match (m//)

2009-05-27 Thread admin2
How can I suppress the first "Use of uninitialized value in pattern match (m//)" warning message. code and output are below. code # cat ./fix_archive.pl #!/usr/bin/perl use warnings; use strict; my @files = <*> unless /.mbox^/; foreach my $file (@files) { print $file . "\n";

Re: interaction with a module and http tags

2009-05-27 Thread Raymond Wan
Hi Joe, jm wrote: i had actually tried to include that early on but apparently the stars weren't properly aligned just then. that works perfectly. thanks for "making" me revisit that option. i figured it would be something simple, just threw me off since it hasn't ever been required when i

Dynamic library

2009-05-27 Thread Patrick Dupre
Hello, I used to build dynamic libraries in c (.so) that I can then call from perl. However, in c the static libraries are more efficient than the dynamic libraries. So can I call a static c library from perl ? for the dynamics library, in my Makefile.PL, I put: LIBS=> ['-lm

Parsing TXT document and output to XML

2009-05-27 Thread Stephen Reese
List, I've been working on a method to parse a PDF or TXT document and output the results to XML over at Experts Exchange. http://www.experts-exchange.com/Programming/Languages/Scripting/Perl/Q_24439630.html You may view the attached document or if the mailing list doesn't allow here is a copy of

RE: skipping a repeated header

2009-05-27 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Kirk Wythers [mailto:kwyth...@umn.edu] > Sent: Wednesday, May 27, 2009 10:16 > To: Wagner, David --- Senior Programmer Analyst --- CFS > Cc: beginners@perl.org > Subject: Re: skipping a repeated header > > Thanks David. I didn't include my attempts because the

RE: skipping a repeated header

2009-05-27 Thread Wagner, David --- Senior Programmer Analyst --- CFS
> -Original Message- > From: Kirk Wythers [mailto:kwyth...@umn.edu] > Sent: Wednesday, May 27, 2009 09:31 > To: beginners@perl.org > Subject: skipping a repeated header > > I have a large datafile that I am trying to read into a postgresql > database. I think I have the db_connect stuff

Re: skipping a repeated header

2009-05-27 Thread Jim Gibson
On 5/27/09 Wed May 27, 2009 9:15 AM, "Kirk Wythers" scribbled: > Thanks David. I didn't include my attempts because the postgresql > stuff took up so many lines. I have snippet out the data read part > (including your suggestion) and pated below. As you can see I also, > sent a number of variab

Re: How to append to existing excel sheet?

2009-05-27 Thread Jim Gibson
On 5/27/09 Wed May 27, 2009 2:14 AM, "Kelvin Philip" scribbled: > Hi, > > Is there any method to append a row to an existing Excel file? Can I do it > using the Spreadsheet::WriteExcel module? The Spreadsheet::WriteExcel (SS:WE) module will not add data to an existing spreadsheet. If you are

Re: skipping a repeated header

2009-05-27 Thread Kirk Wythers
Thanks David. I didn't include my attempts because the postgresql stuff took up so many lines. I have snippet out the data read part (including your suggestion) and pated below. As you can see I also, sent a number of variables in the file. Again I was trying to not fill the list with too m

Re: skipping a repeated header

2009-05-27 Thread Chas. Owens
On Wed, May 27, 2009 at 11:30, Kirk Wythers wrote: > I have a large datafile that I am trying to read into a postgresql database. > I think I have the db_connect stuff down, but I'm fighting with the part > that reads the file to be processed. The file contains a repeating structure > of header li

Re: skipping a repeated header

2009-05-27 Thread smu
hey, On Wed, May 27, 2009 at 10:30:37AM -0500, Kirk Wythers wrote: > [...] > > I want to read in the lines that begin with the date format, but skip > all the header stuff. Can anyone suggest a strategy for a, "if the line > begins with , go ahead and read". > > Thanks in advance. like thi

skipping a repeated header

2009-05-27 Thread Kirk Wythers
I have a large datafile that I am trying to read into a postgresql database. I think I have the db_connect stuff down, but I'm fighting with the part that reads the file to be processed. The file contains a repeating structure of header lines like this: TOA5B4WARM_CCR1000 16474

Re: Pattern match question

2009-05-27 Thread Jenda Krynicky
Date sent: Wed, 27 May 2009 16:50:41 +0800 Subject:Pattern match question From: Á÷Ë(R)`Oô To: beginners@perl.org > Hi, All: > > I want to parse data from a HTML page, data like: > > > > >

Re: interaction with a module and http tags

2009-05-27 Thread jm
i had actually tried to include that early on but apparently the stars weren't properly aligned just then. that works perfectly. thanks for "making" me revisit that option. i figured it would be something simple, just threw me off since it hasn't ever been required when i do all the coding insid

Re: interaction with a module and http tags

2009-05-27 Thread jm
On Wed, May 27, 2009 at 4:21 AM, Raymond Wan wrote: > > Hi Joe, > > > jm wrote: >> >> then the ... code does not process correctly; it is >> ignored unless there is a 2nd pair of tags in the print >> statement ("perl inline html") > > > In addition to Gunnar's questions, if you are still stuck,

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
hey, thanks for the reply. The "-|" was the right option for me. The reason is because I only need to get the first 4 lines of output of the external program. "-|" was perfect because I don't have to base the stopping on time but rather on the number of output lines. Another problem solved!!!

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Chas. Owens
On Wed, May 27, 2009 at 07:24, Michael Alipio wrote: > > Sorry about the indention... must be the mail client i'm using. > I need to fork because the external program I want to run inside the child > runs infinitely. I want to have a timer running in the parent and after that, > kill the child.

RE: Question about split

2009-05-27 Thread sanket vaidya
-Original Message- From: Chas. Owens [mailto:chas.ow...@gmail.com] Sent: Wednesday, May 27, 2009 4:52 PM To: sanket vaidya Cc: beginners@perl.org Subject: Re: Question about split On Wed, May 27, 2009 at 06:45, sanket vaidya wrote: > Hi all, > > Kindly look at the code below: > > use w

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
Sorry about the indention... must be the mail client i'm using. I need to fork because the external program I want to run inside the child runs infinitely. I want to have a timer running in the parent and after that, kill the child. Without forking, I have to do a pkill myprogname I'm reading th

Re: Question about split

2009-05-27 Thread Chas. Owens
On Wed, May 27, 2009 at 06:45, sanket vaidya wrote: > Hi all, > > Kindly look at the code below: > > use warnings; > use strict; > > $_ = 'Welcome to openSUSE 11.0 (X86-64) - Kernel \r (\l).'; > > my @numbers = split /\D+/; snip > Why the first element of @numbers is 'blank'? Kindly explain with e

Re: variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Chas. Owens
On Wed, May 27, 2009 at 05:42, Michael Alipio wrote: > > Hi, > > I have to run an external program but the program does not termination on > some conditions, e.g, ping, will not exit unless you specify -c or some other > circumstances. > > > Now I what I want to do is: > > my @array; > die "Cann

Question about split

2009-05-27 Thread sanket vaidya
Hi all, Kindly look at the code below: use warnings; use strict; $_ = 'Welcome to openSUSE 11.0 (X86-64) - Kernel \r (\l).'; my @numbers = split /\D+/; for (0..$#numbers) { print "$_ : $numbers[$_]\n"; } Output: 0 : 1 : 11 2 : 0 3 : 86 4 : 64 Why the first element

RE: How to append to existing excel sheet?

2009-05-27 Thread sanket vaidya
-Original Message- From: Kelvin Philip [mailto:kelvinphi...@gmail.com] Sent: Wednesday, May 27, 2009 2:45 PM To: beginners@perl.org Subject: How to append to existing excel sheet? >>Hi, >>Is there any method to append a row to an existing Excel file? Can I do it >>using the Spreadsheet:

RE: How to append to existing excel sheet?

2009-05-27 Thread sanket vaidya
-Original Message- From: Kelvin Philip [mailto:kelvinphi...@gmail.com] Sent: Wednesday, May 27, 2009 2:45 PM To: beginners@perl.org Subject: How to append to existing excel sheet? Hi, Is there any method to append a row to an existing Excel file? Can I do it using the Spreadsheet::WriteE

variables gets shared to child but resets back after exiting fork

2009-05-27 Thread Michael Alipio
Hi, I have to run an external program but the program does not termination on some conditions, e.g, ping, will not exit unless you specify -c or some other circumstances. Now I what I want to do is: my @array; die "Cannot fork myprog" unless (defined my $pid = fork) if ($pid==0){ open MYPROG

Re: interaction with a module and http tags

2009-05-27 Thread Raymond Wan
Hi Joe, jm wrote: then the ... code does not process correctly; it is ignored unless there is a 2nd pair of tags in the print statement ("perl inline html") In addition to Gunnar's questions, if you are still stuck, you need to also clarify what "does not process correctly" mean. Obvio

Re: Pattern match question

2009-05-27 Thread Alexander Koenig
You wrote on 05/27/2009 10:50 AM: > I want to match one ... pair. > > my code : > > my $pattern = "()"; ... > but I got the whole matches instead of one ... pair each loop. Do need to de-greedify it. my $pattern = "()"; This should do the trick. hth Alex -- To unsubscribe, e-mail: beginner

How to append to existing excel sheet?

2009-05-27 Thread Kelvin Philip
Hi, Is there any method to append a row to an existing Excel file? Can I do it using the Spreadsheet::WriteExcel module? Looking forward to hear from you. Regards, Kelvin

Pattern match question

2009-05-27 Thread 流水音
Hi, All: I want to parse data from a HTML page, data like: YEMEN YE

Re: grep Net::FTP

2009-05-27 Thread Mihir Kamdar
thanks John...my problem is solvedam trying to add more functionalities to the script. Will seek help again if faced with any issue.. On Tue, May 26, 2009 at 11:31 AM, John W. Krahn wrote: > Mihir Kamdar wrote: > >> Hi, >> >> I want to write a perl script which will get files from multiple >