Re: finding a blank line

2003-10-15 Thread Hacksaw
> Hacksaw wrote: > > > > > I know this is a no brainer, but this line of code does not always work: > > > last if( /^\n/ or /^\s+\n/ ); > > > > Why not > > > > last if /^\s*$/; > > > > You don't need the () in this version of the construction. > > That's logically identical to > > last unless /

Re: how to read from more than one files at a time

2003-10-15 Thread John W. Krahn
Perldiscuss - Perl Newsgroups And Mailing Lists wrote: > > Hi, Hello, > I need to read from more than one file at a time and do some operation on > the strings and join them together, and put into one output file. > > Here is the code. But I noticed the second file never get read. It must be >

Re: is next implied in a set of if elsifs?

2003-10-15 Thread Tore Aursand
On Wed, 15 Oct 2003 17:34:33 -0400, Dan Anderson wrote: > How is speed affected in the following scenarios: > [...] Why don't you find out? Take a look at the Benchmark module. There is also a 'SWITCH' module out there, I think. You might look at that one, too. -- Tore Aursand <[EMAIL PROTEC

Re: Split multidimensional array into 4 multidimensional arrays

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 08:22 PM, Kevin Old wrote: Yes, you're right. This is how I meant to define my array: my @AoA = ( [ 1..12 ], [ 'A'..'L' ] ); Ok, what I need is for the AoA to be reformatted like this into another AoA. 1st 4 columns(1-4,A-D), "empty column", Next 4 columns(5-

Re: Split multidimensional array into 4 multidimensional arrays

2003-10-15 Thread Kevin Old
On Wed, 2003-10-15 at 17:43, James Edward Gray II wrote: > On Wednesday, October 15, 2003, at 04:23 PM, Kevin Old wrote: > > > Hello everyone, > > > > I have a multidimensional array that I need to split into 4 > > multidimensional arrays. I've tried the examples from the Programming > > Perl 3r

Re: is next implied in a set of if elsifs?

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 07:30 PM, Dan Anderson wrote: Now this is not actually reflective of the code in my program. I just needed a clean, controlled environment to compare different things. Do you have a large if/else decision tree? We might be able to provides some ideas there if

Re: is next implied in a set of if elsifs?

2003-10-15 Thread Dan Anderson
The code was pretty simple. It was a test case. So I created three basic files: $condition = FALSE; if ($condition) { print "TRUE"; } # condition is never reached And then I copied and pasted the following 1023 times: #test 1: if ($condition) { print "TRUE"; } # condition is never reached #te

Re: is next implied in a set of if elsifs?

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 05:25 PM, Dan Anderson wrote: But what's the speed concerns here? This is negligable. Well until applied across the entire program. The program I am working with is significantly longer then the example. Okay, but in order to write a program, you must include

RE: how to read from more than one files at a time

2003-10-15 Thread LoBue, Mark
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 15, 2003 11:42 AM > To: [EMAIL PROTECTED] > Subject: how to read from more than one files at a time > > > Hi, > > I need to read from more than one file at a time and do some > operation

how to read from more than one files at a time

2003-10-15 Thread PerlDiscuss - Perl Newsgroups and mailing lists
Hi, I need to read from more than one file at a time and do some operation on the strings and join them together, and put into one output file. Here is the code. But I noticed the second file never get read. It must be sth very simple to overcome this. Can anyone give me a hint? thanks, Ben # U

Re: How do I escape shell commands?

2003-10-15 Thread Darin McBride
Dan Anderson wrote: > Is it possible to do something to a string so that it gets escaped for a > shell command (i.e. if I'm executing a command and I have the file name > "foo's bar.jpg" it will be escaped to: "foo\'s\ bar.jpg"? > > Right now the following script is giving me problems because whe

Re: is next implied in a set of if elsifs?

2003-10-15 Thread Paul Johnson
On Wed, Oct 15, 2003 at 06:25:45PM -0400, Dan Anderson wrote: > > But what's the speed concerns here? This is negligable. > > Well until applied across the entire program. The program I am working > with is significantly longer then the example. Just a few random quotes, attached to this messa

Re: is next implied in a set of if elsifs?

2003-10-15 Thread Dan Anderson
> But what's the speed concerns here? This is negligable. I just double checked and each if statement takes roughly 9.8 microseconds more to execute then an elsif. That may not seem like a lot but over a program spanning several files (perhaps as much as a meg in code when finished) and using th

Re: Help w/Class::Date Date.xs

2003-10-15 Thread david
[EMAIL PROTECTED] wrote: > Your response is great! > > Being new to the environment, simple and fundamental things can be > frustrating. Your step-by-step instruction not only made it possible to > install but it gave me a clue into understanding how the perl/cpan are > structured/organized. >

Re: is next implied in a set of if elsifs?

2003-10-15 Thread Dan Anderson
> But what's the speed concerns here? This is negligable. Well until applied across the entire program. The program I am working with is significantly longer then the example. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: is next implied in a set of if elsifs?

2003-10-15 Thread Jeff 'japhy' Pinyan
On Oct 15, Dan Anderson said: >while ($foo) { > do_1() if ($condition_1); > do_2() if ($condition_2); > # ... >} Multiple conditions are evaluated there. If $condition_1 and $condition_2 are true, both do_1() and do_2() will be done. >while ($foo) { > if ($condition_1) { >do_1(); > } >

Re: is next implied in a set of if elsifs?

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 04:34 PM, Dan Anderson wrote: How is speed affected in the following scenarios: 1) Using a number of if statements i.e. while ($foo) { do_1() if ($condition_1); do_2() if ($condition_2); # ... } Every condition of this must be tested ever time through, so

Re: Split multidimensional array into 4 multidimensional arrays

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 04:23 PM, Kevin Old wrote: Hello everyone, I have a multidimensional array that I need to split into 4 multidimensional arrays. I've tried the examples from the Programming Perl 3rd ed. Chapter 9 for splicing Arrays of Arrays and am not having any luck. Here's

is next implied in a set of if elsifs?

2003-10-15 Thread Dan Anderson
How is speed affected in the following scenarios: 1) Using a number of if statements i.e. while ($foo) { do_1() if ($condition_1); do_2() if ($condition_2); # ... } 2) Using a series of if elsifs i.e. while ($foo) { if ($condition_1) { do_1(); } elsif ($condition_2) { do_2();

Split multidimensional array into 4 multidimensional arrays

2003-10-15 Thread Kevin Old
Hello everyone, I have a multidimensional array that I need to split into 4 multidimensional arrays. I've tried the examples from the Programming Perl 3rd ed. Chapter 9 for splicing Arrays of Arrays and am not having any luck. Here's an example of how my data looks: [1 2 3 4 5 6 7 8 9 10 11 12]

Re: finding a blank line

2003-10-15 Thread Rob Dixon
Hacksaw wrote: > > > I know this is a no brainer, but this line of code does not always work: > > last if( /^\n/ or /^\s+\n/ ); > > Why not > > last if /^\s*$/; > > You don't need the () in this version of the construction. That's logically identical to last unless /\S/; Rob -- To unsubsc

Re: How do I escape shell commands?

2003-10-15 Thread John W. Krahn
Dan Anderson wrote: > > Is it possible to do something to a string so that it gets escaped for a > shell command (i.e. if I'm executing a command and I have the file name > "foo's bar.jpg" it will be escaped to: "foo\'s\ bar.jpg"? > > Right now the following script is giving me problems because w

Re: finding a blank line

2003-10-15 Thread Hacksaw
> I know this is a no brainer, but this line of code does not always work: > last if( /^\n/ or /^\s+\n/ ); Why not last if /^\s*$/; You don't need the () in this version of the construction. '*' matches zero or more of the preceding RE. -- The future is what the present can bear. http://www.ha

Re: How do I escape shell commands?

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 01:04 PM, Dan Anderson wrote: Thanks for your help, but I still have a few questions: If we drop the my `ls` trick above, we can use Perl's directory handling calls: use Cwd; opendir DIR, getcwd() or die "Directory error: $!\n"; The code you gave me gives me e

Re: How do I escape shell commands?

2003-10-15 Thread Dan Anderson
Thanks for your help, but I still have a few questions: > If we drop the my `ls` trick above, we can use Perl's directory > handling calls: > use Cwd; > opendir DIR, getcwd() or die "Directory error: $!\n"; > The code you gave me gives me errors when run: readline() on unopened filehandle DIR

Re: How do I escape shell commands?

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 12:11 PM, Dan Anderson wrote: Is it possible to do something to a string so that it gets escaped for a shell command (i.e. if I'm executing a command and I have the file name "foo's bar.jpg" it will be escaped to: "foo\'s\ bar.jpg"? I don't know about this, but

How do I escape shell commands?

2003-10-15 Thread Dan Anderson
Is it possible to do something to a string so that it gets escaped for a shell command (i.e. if I'm executing a command and I have the file name "foo's bar.jpg" it will be escaped to: "foo\'s\ bar.jpg"? Right now the following script is giving me problems because whenever the mv command is execu

Segmentation fault - probably Zlib.pm module problem

2003-10-15 Thread Rafal Gala
Hello I have got a problem with Compress::Zlib module for Perl. When I load some other module that uses Compress::Zlib module, for example CPAN, it always crashes with "segmentation fault" message. I have already tried 5 last versions of Compress::Zlib module and there is always the same probl

Re: A trouble

2003-10-15 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > > Hello... Hello, > I am a beginner in Perl an I have a trouble, I am sure you are going to > help me. > > Suppose I have a file with, for example, 10 lines, every one composed by > a inferior value and a superior value and a string. Every inferior value > is equal to

Re: A trouble

2003-10-15 Thread Tore Aursand
On Tue, 14 Oct 2003 16:06:32 +, bastidas wrote: > Suppose I have a file with, for example, 10 lines, every one composed by > a inferior value and a superior value and a string. Every inferior value > is equal to superior value of the before line. On the other hand, I have > other file with, for

Re: finding a blank line

2003-10-15 Thread Tore Aursand
On Wed, 15 Oct 2003 02:24:25 -0500, Jerry Preston wrote: > I know this is a no brainer, but this line of code does not always work: > last if( /^\n/ or /^\s+\n/ ); Can't you check the length of the line? last unless ( length ); This will work if the line really _is_ blank. However, humans ten

Re: web-based application question

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 10:21 AM, Gary Stainburn wrote: James, I'm curious, why bother running a daemon which needs starting/stopping, and watching to make sure it doesn't die, when if you're going to use CGIs to populate the directory in the first place, why don't you simply call

Re: web-based application question

2003-10-15 Thread Wiggins d'Anconia
> James, > > I'm curious, why bother running a daemon which needs starting/stopping, and > watching to make sure it doesn't die, when if you're going to use CGIs to > populate the directory in the first place, why don't you simply call the > script from there? > > What happens when 1 file t

Re: NET::FTP problem w/CHMOD

2003-10-15 Thread [EMAIL PROTECTED]
Thanks Wiggins and Rob, '$ftp->site("CHMOD 755 $file")' worked the first time I popped it in - perfectly. Oddly, '$ftp->command("SITE CHMOD 755 $file")'and '$ftp->quot("SITE CHMOD 755 $file")' wouldn't hang the connection, and they would did successfully execute the chmod command via the ftp c

RE: Excel/Word to HTML

2003-10-15 Thread LoneWolf
Making them to PDF is already done, PDF is done via GhostGum, Redmon, and Ghostview to make free Color PDF files that takes only the person telling it to print to a specific printer and then where to save the file. I wish it was that simple, but this is a requirement for them to be in HTML. I d

Re: web-based application question

2003-10-15 Thread Gary Stainburn
On Wednesday 15 Oct 2003 3:21 pm, James Edward Gray II wrote: > On Wednesday, October 15, 2003, at 09:03 AM, PD Schloss wrote: > > Hi, > > > > I have a perl script that I would like to make available on-line. I > > suspect the target community (microbiologists) has no interest in > > getting/lear

Re: web-based application question

2003-10-15 Thread Gary Stainburn
On Wednesday 15 Oct 2003 3:03 pm, PD Schloss wrote: > Hi, > > I have a perl script that I would like to make available on-line. I > suspect the target community (microbiologists) has no interest in > getting/learning perl for themselves and would prefer to use it as an > on-line resource. Since I

RE: Excel/Word to HTML

2003-10-15 Thread Tristram Nefzger
Hi, There may be a way to execute MS apps in batch mode to output HTML and that's likely to result in reasonable HTML fomatting that could otherwise be hard to do. If I was given this project, I would try to change the requirement to produce HTML to producing PDF, and then "cheat" by looking for

RE: web-based application question

2003-10-15 Thread Tristram Nefzger
Hi, If your application will be doing search and retrieval, there's a good chance something similar has already been developed that can be used as a starting point. http://www.perl.com/pub/q/resources is a good starting point for finding out what's already available in perl. An excellent intro

Re: Another sub clean up

2003-10-15 Thread John W. Krahn
Sudarshan Raghavan wrote: > > Sudarshan Raghavan wrote: > > > > ($ref_to eq 'ARRAY') && do { > > foreach my $arr_elem (@{$_}) { > > $arr_elem =~ s/^\s+//; > > $arr_elem =~ s/\s+$//; > > } > > last S

RE: web-based application question

2003-10-15 Thread Wiggins d'Anconia
On 15 Oct 2003 09:03:01 -0500, PD Schloss <[EMAIL PROTECTED]> wrote: > Hi, > > I have a perl script that I would like to make available on-line. I > suspect the target community (microbiologists) has no interest in > getting/learning perl for the

Re: web-based application question

2003-10-15 Thread James Edward Gray II
On Wednesday, October 15, 2003, at 09:03 AM, PD Schloss wrote: Hi, I have a perl script that I would like to make available on-line. I suspect the target community (microbiologists) has no interest in getting/learning perl for themselves and would prefer to use it as an on-line resource. Since

web-based application question

2003-10-15 Thread PD Schloss
Hi, I have a perl script that I would like to make available on-line. I suspect the target community (microbiologists) has no interest in getting/learning perl for themselves and would prefer to use it as an on-line resource. Since I am a newbie at much of this, I was wondering if someone could

Re: Re: How to get fields from a SQL DB one by one

2003-10-15 Thread Manfred . Beilfuss
Hi , if you want "sql-fields" separate you will have to select them separately, o.K.? First you will have to have e.g. DBI, >> #!/usr/local/bin/perl >> use DBI; then you will need a driver for your db (e.g. dbi::db2 ) or use DBI::ODBC! use DBD::DB2::Constants; use DBD::DB2 qw($attrib_int $attrib

Excel/Word to HTML

2003-10-15 Thread LoneWolf
I'm looking for a script that I can cron to look in a directory and parse every M$ file into a straight HTML file, regardless of it being Wird, Excel, or Powerpoint. Are there any scripts currently out there that do this, or am I looking at having to build it? Side Note: How can I make a program

AW: How to get fields from a SQL DB one by one

2003-10-15 Thread B. Fongo
Your question says very little about the your problem. Try formulating it more precisely. Babale Fongo > -Ursprüngliche Nachricht- > Von: ramakrishna [mailto:[EMAIL PROTECTED] > Gesendet: Mittwoch, 15. Oktober 2003 08:42 > An: [EMAIL PROTECTED] > Betreff: How to get fields from a SQL DB

Re: How to get fields from a SQL DB one by one

2003-10-15 Thread ramakrishna
Ya i am using DBI. Ramakrishna.S - Original Message - From: "Ramprasad" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 15, 2003 5:35 PM Subject: Re: How to get fields from a SQL DB one by one > On Wed, 15 Oct 2003 12:11:43 +0530, Ramakrishna wrote: > > > Hi, > >

Re: How to get fields from a SQL DB one by one

2003-10-15 Thread Ramprasad
On Wed, 15 Oct 2003 12:11:43 +0530, Ramakrishna wrote: > Hi, > > Can any one tell me How to get fields from a SQL Database. > I need to get each field separately. > > Thanks in advance, > Ramakrishna.S Which database, Are U using DBI Ram -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addit

Re: finding a blank line

2003-10-15 Thread ramprasad
Jerry Preston wrote: Hi! I know this is a no brainer, but this line of code does not always work: last if( /^\n/ or /^\s+\n/ ); What am I missing? Is there a better way? Thanks, Jerry Are you trying to match a multiline string then do a /^\s*$/m Bye Ram -- To unsubscribe, e-mail: [EMAIL PR

Re: finding a blank line

2003-10-15 Thread Rob Dixon
Jerry Preston wrote: > > I know this is a no brainer, but this line of code does not always work: > > last if( /^\n/ or /^\s+\n/ ); > > What am I missing? Is there a better way? In general it would be last unless /\S/; but I can't see why what you've written wouldn't work. Rob -- To unsu

Re: Another sub clean up

2003-10-15 Thread Rob Dixon
<[EMAIL PROTECTED]> wrote: > > Can someone hlpe me clean up this trim? > > Rule: remove all trailing blanks and newline/LF > > Do I need a chomp here somewhere? > > sub trim > { my $z = $_[0]; > > $z =~ s/^\s+//; > $z =~ s/\s+$//; > > return $z; > } Do you mean /leading/ and trailing, which

Re: A trouble

2003-10-15 Thread Rob Dixon
[EMAIL PROTECTED] wrote: > > I am a beginner in Perl an I have a trouble, I am sure you are going to > help me. > > Suppose I have a file with, for example, 10 lines, every one composed by > a inferior value and a superior value and a string. Every inferior value > is equal to superior value of the

solved - seperate file for constant definition

2003-10-15 Thread Gary Stainburn
On Wednesday 15 Oct 2003 11:31 am, Gary Stainburn wrote: > Hi folks, > > I know this has been discussed recenty, and I've actually got it working > elsewhere, but the script I'm currently working on isn't working. > > I've got file /home/gary/bin/svcdetails.pm which contains: > > # Config file for

seperate file for constant definition

2003-10-15 Thread Gary Stainburn
Hi folks, I know this has been discussed recenty, and I've actually got it working elsewhere, but the script I'm currently working on isn't working. I've got file /home/gary/bin/svcdetails.pm which contains: # Config file for import/export routines my %ctrl_accs=('11'=>'VSC|S|Vehicle Cash

Re: Another sub clean up

2003-10-15 Thread perl
> On Tue, 14 Oct 2003 19:26:50 -0700, perl wrote: >> Can someone hlpe me clean up this trim? > > What do you actually mean by "clean up"? Make the code shorter and, > maybe, more obfuscated? Why? -- - more shorter - Yes - more obfuscated - hhmm... nice to know shortcut -- > >>

Re: finding a blank line

2003-10-15 Thread Sudarshan Raghavan
Jerry Preston wrote: > Hi! > > I know this is a no brainer, but this line of code does not always work: > > last if( /^\n/ or /^\s+\n/ ); last if (/^\s*$/); Out of curiosity, can you post the cases for which your statement did not work? Are these strings with embedded newlines? > > > What am I

Re: Searchable Perl Newsgroups

2003-10-15 Thread Owen Cook
On 14 Oct 2003, PerlDiscuss - Perl Newsgroups and mailing lists wrote: > Are these newsgroups searchable from anywhere ??? > Google groups Owen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Filter::Decrypt2

2003-10-15 Thread PerlDiscuss - Perl Newsgroups and mailing lists
This is perl, v5.6.1 built for i386-linux This is the file: #!/usr/bin/perl use Filter::decrypt2 ; ÿa8HS#5"W5ybnuFE*]S+ ... and a bunch more garble ... This is the output: "bad encryption format at /usr/bin/client_tools line 3." This is what I did: Not much. Basically just looked for the dec

Searchable Perl Newsgroups

2003-10-15 Thread PerlDiscuss - Perl Newsgroups and mailing lists
Are these newsgroups searchable from anywhere ??? Thanks for the help! -John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Perl 5.8.1 and Installing Modules

2003-10-15 Thread Adam Gent
Hi All, I have just installed Perl 5.8.1 and am trying to install some modules via CPAN. When I install the module, it always says that it has installed it correctly. But when I come to use it, it can not be found. There is also no sign of module on the hard drive. In perl 5.8.0 it would insta

A trouble

2003-10-15 Thread bastidas
Hello... I am a beginner in Perl an I have a trouble, I am sure you are going to help me. Suppose I have a file with, for example, 10 lines, every one composed by a inferior value and a superior value and a string. Every inferior value is equal to superior value of the before line. On the other h

finding a blank line

2003-10-15 Thread Jerry Preston
Hi! I know this is a no brainer, but this line of code does not always work: last if( /^\n/ or /^\s+\n/ ); What am I missing? Is there a better way? Thanks, Jerry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Another sub clean up

2003-10-15 Thread Tore Aursand
On Tue, 14 Oct 2003 19:26:50 -0700, perl wrote: > Can someone hlpe me clean up this trim? What do you actually mean by "clean up"? Make the code shorter and, maybe, more obfuscated? Why? > Rule: remove all trailing blanks and newline/LF sub trim { my $string = shift; chomp( $str