Re: sorting AoA

2004-03-27 Thread WC -Sx- Jones
John W. Krahn wrote: Wc -Sx- Jones wrote: James Edward Gray II wrote: if (-s $output_file) { Why are you attributing to James what Guruguhan wrote? :) I'm not -- however that statement was promoted into the portion of the thread that James asked about (which I was replying) so James can

Re: sorting AoA

2004-03-27 Thread John W. Krahn
Wc -Sx- Jones wrote: James Edward Gray II wrote: if (-s $output_file) { Why are you attributing to James what Guruguhan wrote? There are other reasons to test for a file size prior to opening it :) Why open a data file if it is zero length when you expect data? What if -s

Re: sorting AoA

2004-03-27 Thread John W. Krahn
Wc -Sx- Jones wrote: John W. Krahn wrote: Wc -Sx- Jones wrote: James Edward Gray II wrote: if (-s $output_file) { Why are you attributing to James what Guruguhan wrote? :) I'm not -- however that statement was promoted into the portion of the thread that James asked about

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
R. Joseph Newton [EMAIL PROTECTED] writes: [EMAIL PROTECTED], Thanks for the advice and code snippet... I'm studying your code now for adding to my knowledge base. But understand that base is quite small at present so it takes me a while to figure out what code is doing. Usually involving many

RE: Home made mail news search tool, and folded header lines

2004-03-27 Thread Charles K. Clarkson
Harry Putnam [EMAIL PROTECTED] wrote: : : R. Joseph Newton [EMAIL PROTECTED] writes: : : Something like: : [...] snipped getopts and other unrelated stuff : while(FILE){ : chomp; : my $line = $_; : : Why here. Since you are doing this with each line, : you

Re: sorting AoA

2004-03-27 Thread WC -Sx- Jones
John W. Krahn wrote: replying) so James can take ownership of those parts of this thread. Not under most country's copyright laws he can't. :-( LOL :) I'd like to see that erroneous verbage - as words, expressed as thoughts and ideas in the discourse of conversation (whether spoken or

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread WC -Sx- Jones
Harry Putnam wrote: R. Joseph Newton [EMAIL PROTECTED] writes: An example would be that I wanted to run a series of regex against each line of input (While in headers) grabing the matches into an array for printing. Something like: [...] snipped getopts and other unrelated stuff while(FILE){

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
Charles K. Clarkson [EMAIL PROTECTED] writes: : while(FILE){ : chomp; : my $line = $_; : : Why here. Since you are doing this with each line, : you could write in the loop control: : while (my $line = FILE) { : : Not sure I understand the advantage.

HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread WC -Sx- Jones
HOW-TO of the Month Club (end Of MARCH Edition) (Even though many of you *flamed* me - _I' bck_ :) This edition I will show you how to declare variables WITHOUT using *my* $var everywhere... #! perl -Tw use strict; use warnings; # get execution name $::prog = $0; # clean off directory

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread Daniel Staal
--As of Saturday, March 27, 2004 10:17 AM -0500, WC -Sx- Jones is alleged to have said: Also, all of these $:: are brought into GLOBAL usage (which some programmers frown upon much like GOTO syntax is frowned upon.) --As for the rest, it is mine. They why aren't you just leaving off warnings

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread Morbus Iff
This edition I will show you how to declare variables WITHOUT using *my* $var everywhere... I'm not sure this is the sorta stuff I'd be teaching beginners. There are far better ways to shape impressionable minds, and this syntax just lends credence to the Perl is ugly theory (more adequately

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread James Edward Gray II
On Mar 27, 2004, at 9:17 AM, WC -Sx- Jones wrote: HOW-TO of the Month Club (end Of MARCH Edition) (Even though many of you *flamed* me - _I' bck_ :) [snip code that scares me] Depending upon the number of flames I may post something REALLY basic next time %) I know I've complained that

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread Randy W. Sims
On 3/27/2004 10:17 AM, WC -Sx- Jones wrote: HOW-TO of the Month Club (end Of MARCH Edition) (Even though many of you *flamed* me - _I' bck_ :) I didn't catch that thread, so I don't know why you were flamed, but I see no problem with posting occasional HOW-TOs so long as they are

RE: Home made mail news search tool, and folded header lines

2004-03-27 Thread Charles K. Clarkson
Harry Putnam [EMAIL PROTECTED] wrote: : : Charles K. Clarkson [EMAIL PROTECTED] writes: : : : I wanted a way to ensure that each reg has hit at : : least once. Otherwise we don't print. So I used a : : formulation like this (Not posted previously for : : clarity): : : : : if

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread Bruce Ferrell
I'm not a good enough coder to judge issues of style... Mostly grab a tweak stuff from cookbooks, BUT isn't TMTOYTDI kind of core to PERL? Or is PERL turning into Python? BYW, I like the how-tos -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: warn ?!

2004-03-27 Thread James Edward Gray II
On Mar 27, 2004, at 12:10 AM, R. Joseph Newton wrote: Not exactly. It is not the newline \n that would give the full output of the warn function, but the $! variable, which contains the most recent warning or error message. I believe you are confusing two often paired, but not otherwise

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread WC -Sx- Jones
Bruce Ferrell wrote: is PERL turning into Python? No, I believe you are beginning to see the commonality between advanced langauges. Perl is, of course, everything other languages should have been. BYW, I like the how-tos It is designed to stir things up :) BTW - I highly recommend Perl Medic by

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread WC -Sx- Jones
Morbus Iff wrote: This edition I will show you how to declare variables WITHOUT using *my* $var everywhere... I'm not sure this is the sorta stuff I'd be teaching beginners. There are far better ways to shape impressionable minds, and this syntax just lends credence to the Perl is ugly theory

RE: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread Charles K. Clarkson
WC -Sx- Jones [EMAIL PROTECTED] wrote: : : HOW-TO of the Month Club (end Of MARCH Edition) : : (Even though many of you *flamed* me - _I' bck_ :) : : This edition I will show you how to declare variables : WITHOUT using *my* $var everywhere...

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread WC -Sx- Jones
James Edward Gray II wrote: 1. You show a means of variable declaration that you say replaces my() when in fact it's equivalent to our(). 2. Your use of local() is scary at best. It looks like a step backwards in Perl history to me. local() is pretty misunderstood to begin with and I don't

RE: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread Charles K. Clarkson
Bruce Ferrell [EMAIL PROTECTED] wrote: : : I'm not a good enough coder to judge issues of style... : Mostly grab a tweak stuff from cookbooks, BUT isn't : TMTOWTDI kind of core to PERL? Yes. you are correct. : Or is PERL turning into Python? I don't know Python. Though I doubt it.

OT: spam filters and .sig lines

2004-03-27 Thread WC -Sx- Jones
I must apologize, my aggressive spam filter deleted all of Charles K. Clarkson's posts :( It was unintentional. His .sig: Mobile Homes Specialist matched /(?:Cialis|Viagra|firstclassminds|smartpills|livebbagul|xadmin\.ce\.ro)/ DISCARD Matched Regular Spam I only mention this in case this has

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread WC -Sx- Jones
Charles K. Clarkson wrote: To many of us, we are at war. Perl is so easy to learn that many have adopted very poor programming skills and produced very poor quality programs. It is important to many of us to turn the tide of poor perl programming habits. I strongly agree. Yes, perl allows

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread James Edward Gray II
On Mar 27, 2004, at 10:42 AM, WC -Sx- Jones wrote: 2. Your use of local() is scary at best. It looks like a step backwards in Perl history to me. local() is pretty misunderstood to begin with and I don't think we, of all people, should be adding to the problem. I guess I am think as a

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
Charles K. Clarkson [EMAIL PROTECTED] writes: [...] As programs get larger, many perl programmers find declaring variables at the top of a code structure a poor idea. In perl it is generally better to declare a variable at or very near it's first invocation. I appreciate you letting me

output on stderr from `next'

2004-03-27 Thread Harry Putnam
I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not posting it here but the next does exit a sub routine. That is why I put it there. So how

Re: warn ?!

2004-03-27 Thread R. Joseph Newton
James Edward Gray II wrote: On Mar 27, 2004, at 12:10 AM, R. Joseph Newton wrote: Not exactly. It is not the newline \n that would give the full output of the warn function, but the $! variable, which contains the most recent warning or error message. I believe you are confusing

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Randy W. Sims wrote: On 3/27/2004 2:23 AM, R. Joseph Newton wrote: These lines should probably be going into a hash, keyed to the portion of the line before the colon. Don't forget that some header fields can appear more than once. Regards, Randy. Actually, I'm pretty sure it is only

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Smoot Carl-Mitchell
On Sat, 27 Mar 2004 11:44:28 -0800 R. Joseph Newton [EMAIL PROTECTED] wrote: Randy W. Sims wrote: On 3/27/2004 2:23 AM, R. Joseph Newton wrote: These lines should probably be going into a hash, keyed to the portion of the line before the colon. Don't forget that some header fields

Re: warn ?!

2004-03-27 Thread James Edward Gray II
On Mar 27, 2004, at 1:32 PM, R. Joseph Newton wrote: It seems pretty clear to me, that although modular in their function, these Perl built-in variables were precisely designed to work with the warn and die functions. I'll hold with my essential point--that you get a lot more useful

Re: output on stderr from `next'

2004-03-27 Thread Randy W. Sims
Harry Putnam wrote: I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not posting it here but the next does exit a sub routine. That is why I put

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: Something like: [...] snipped getopts and other unrelated stuff while(FILE){ chomp; my $line = $_; Why here. Since you are doing this with each line, you could write in the loop control: while (my $line = FILE) { Not sure I

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Charles K. Clarkson wrote: Harry Putnam [EMAIL PROTECTED] wrote: : : R. Joseph Newton [EMAIL PROTECTED] writes: : : Something like: : [...] snipped getopts and other unrelated stuff : while(FILE){ : chomp; : my $line = $_; : : Why here. Since you

Re: output on stderr from `next'

2004-03-27 Thread Paul Johnson
On Sat, Mar 27, 2004 at 03:24:13PM -0500, Randy W. Sims wrote: Harry Putnam wrote: I'm getting this output on stderr from a next clause: Exiting subroutine via next at ./test_bol.pl line 101. I wondered why this happens. Is it considered an error or what? The script is lengthy so not

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: I think Joseph was implying the 'chomp'. This is still shorter and IMO clearer than using $_. while ( my $line = FILE ) { chomp $line; I hope it doesn't sound like I'm being a hard head... because at my stage of skill I'm not likely to stand on

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: ... I'm having trouble seeing what is shorter or better about this. : sub test_hdr_good { I count 13 characters in test_hdr_good header_is_good { has 15 characters. For the price of two characters, you can = indicate the type of information [boolean] returned. If this

Re: sorting AoA

2004-03-27 Thread R. Joseph Newton
N, Guruguhan (GEAE, Foreign National, EACOE) wrote: [Implementation stuff snipped] Can some one tell me how do I this? Well, if you tellus what you want as output, we could maybe start. Hint--if you really have production code with variable names like @array1, @array2, etc., the best

Re: sorting AoA [was the subject]

2004-03-27 Thread R. Joseph Newton
WC -Sx- Jones wrote: John W. Krahn wrote: replying) so James can take ownership of those parts of this thread. Not under most country's copyright laws he can't. :-( LOL :) I'd like to see that erroneous verbage - as words, expressed as thoughts and ideas in the discourse of

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
R. Joseph Newton wrote: Ooops ... At a time when I had 13, 038 message in a given mailbox, should be ... At a time when I had 13, 1398 message in a given mailbox, Which makes the following more meaningful: these were the only header items to appear in exactly that many messages: Date:

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: Yes, I see now. I think I may not have understood the meaning of `global'. I understood it to mean these variables could theoretically be exported as in the case of `do ./this_script; from another script. I was under the impression that a `my($var);' at the beginning

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread John W. Krahn
Wc -Sx- Jones wrote: Harry Putnam wrote: R. Joseph Newton [EMAIL PROTECTED] writes: Why here. Since you are doing this with each line, you could write in the loop control: while (my $line = FILE) { Not sure I understand the advantage. In my formulation, `$line' is minus the

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Smoot Carl-Mitchell wrote: Actually, I'm pretty sure it is only the Received header that would ever show more than once in the main header of a message. Read the relevant RFCs for mail message standards. I'd start with RFC2822 and work forward from there. This is definitely a good idea

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
R. Joseph Newton [EMAIL PROTECTED] writes: The point here is that the script itelf is too broad a scope for most variables. With a few exceptions, it is best when you can see the entire scope of any variable within a single screen. This takes structure. It is very much worth the effort,

Re: HOW-TO of the Month Club (end Of MARCH Edition)

2004-03-27 Thread R. Joseph Newton
WC -Sx- Jones wrote: James Edward Gray II wrote: 1. You show a means of variable declaration that you say replaces my() when in fact it's equivalent to our(). 2. Your use of local() is scary at best. It looks like a step backwards in Perl history to me. local() is pretty

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Smoot Carl-Mitchell
On Sat, 27 Mar 2004 14:36:56 -0800 R. Joseph Newton [EMAIL PROTECTED] wrote: I'll do some more scanning through my hdr directory to see how many folded lines I actually see. Ooooh! I see The To line can also get folded. I think the trick that I showed for testing for initial space should

Re: output on stderr from `next'

2004-03-27 Thread Harry Putnam
Randy W. Sims [EMAIL PROTECTED] writes: Use 'return' to exit from a subroutine. Use 'next', 'redo', 'last', and 'goto' to alter the execution path in loop constructs; they must appear /inside/ the block owned by the loop construct or within a sub-block. Ahh, ok thanks. Return turns out to

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Randy W. Sims
R. Joseph Newton wrote: I count 13 characters in test_hdr_good header_is_good { has 15 characters. My personal preference is that if the variable/function returns a boolean, then the name should start with (is|has|have), etc. if ( has_good_header() ) {...} use constant HAVE_MODULE_FOO = eval {

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Randy W. Sims
R. Joseph Newton wrote: I'll do some more scanning through my hdr directory to see how many folded lines I actually see. Ooooh! I see The To line can also get folded. I think the trick that I showed for testing for initial space should work for that It is very clear that the input processing

Re: warn ?!

2004-03-27 Thread Randy W. Sims
James Edward Gray II wrote: Fact: This has nothing to do with ANY variables, it is the way warn() is designed. Trivia: Did you know that $! does NOT contain an error string. It contains the error *number*. The only reason you see a error sting is that it has an overloaded stringification

date math

2004-03-27 Thread Andrew Gaffney
I'm looking for a way to do some date math. I'm working on a payroll tracking system. I want to provide a list of 2 week periods for the user to select. These periods start from a hard-coded known start of pay period date. I want it to display the 6 most recent 2 week periods. For example, my

Re: warn ?!

2004-03-27 Thread R. Joseph Newton
James Edward Gray II wrote: On Mar 27, 2004, at 1:32 PM, R. Joseph Newton wrote: It seems pretty clear to me, that although modular in their function, these Perl built-in variables were precisely designed to work with the warn and die functions. I'll hold with my essential

Re: CGI and special characters

2004-03-27 Thread John McKown
On Fri, 26 Mar 2004, Howard Fuchs wrote: Hi all: Here is my problem. I have a script which processes input from a textarea which may have 'special characters' in it like ‘ or ’ etc. Unfortunately what I am getting back are these ‘ or ’ respectively. Script snippet

Re: Passing file name /filehandle as argument to a subroutine...

2004-03-27 Thread R. Joseph Newton
urvashi mishra wrote: hi; i am trying to take input from multiple files Various I/P files are specified at command line... What is an I/P file? Do you mean an input file? Can anyone tell me how to pass the file name to a routine that opens it for parsing the same function is

Re: warn ?!

2004-03-27 Thread R. Joseph Newton
Randy W. Sims wrote: James Edward Gray II wrote: Fact: This has nothing to do with ANY variables, it is the way warn() is designed. Trivia: Did you know that $! does NOT contain an error string. It contains the error *number*. The only reason you see a error sting is that it has an

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: Its going very steady... That is, I've never used a reference... : ) What can I say? You've got to take the step, if you want to get there. You will have plenty of help. Until you get these basic structuring skills down you are severely limited in the scope of tasks

Re: warn ?!

2004-03-27 Thread John W. Krahn
Randy W. Sims wrote: James Edward Gray II wrote: Fact: This has nothing to do with ANY variables, it is the way warn() is designed. Trivia: Did you know that $! does NOT contain an error string. It contains the error *number*. The only reason you see a error sting is that it has

Re: date math

2004-03-27 Thread Andrew Gaffney
Chris Charley wrote: Hello Andrew I've enclosed a text file that demonstrates Date::Simple. HTH Chris - Original Message - From: Andrew Gaffney [EMAIL PROTECTED] Newsgroups: perl.beginners To: beginners [EMAIL PROTECTED] Sent: Saturday, March 27, 2004 7:52 PM Subject: date math I'm

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
R. Joseph Newton [EMAIL PROTECTED] writes: Harry Putnam wrote: Its going very steady... That is, I've never used a reference... : ) What can I say? You've got to take the step, if you want to get there. You will have plenty of help. Until you get these basic structuring skills down

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread WC -Sx- Jones
Harry Putnam wrote: One thing you could say is to give an example of what you are talking about. I'm not sure I even know what a `reference' is. About References: http://learn.perl.org/library/beginning_perl/3145_Chap07.pdf A Beginner's Overview of General Perl:

Re: Passing file name /filehandle as argument to a subroutine...

2004-03-27 Thread R. Joseph Newton
R. Joseph Newton wrote: Better not to use the newline at the end. You get more information if you just: open(MIBFH,$file) or die Error opening the $file$!; Should be: open(MIBFH,$file) or die Error opening the $file: $!; Sorry, Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For