Embedding a while construct in a function call. (using CGI)

2003-07-22 Thread Jamie Risk
A few days back I decided that all the html formating I've been doing with Perl had probably been done before; so now I'm reading 'perldoc CGI'. Anyway, in my (newsgroup simplified) old code I had the following; print tbody\n; while ($tabbed_text_fh) {

Re: Embedding a while construct in a function call. (using CGI )

2003-07-22 Thread Jamie Risk
Bob Showalter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] print tbody( Tr( [map { s/([^\n\r]+)[ \t\n\r]+$/$1/; td([split /\t/]) } $tabbed_text_fh] ) ); Thanks, though as usual, I've got another perldoc reference to lookup (map). I'm not sure what your regex is

Re: chomp'ing EOL

2003-07-19 Thread Jamie Risk
Rob Dixon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jamie Risk wrote: I've no control over the EOL of text files that I'm processing; is there a conveniant method using chomp() and the INPUT_RECORD_SEPERATOR ($/) to handle DOS/UNIX/MAC generated text files automatically

Re: Creating html source ...

2003-07-17 Thread Jamie Risk
er, sorry. Is there a module to produce html formatted output? If so, would I be directed to some documentation? I have to assume that any of the simple HTML-izing I want to do with simple text files has already been done. I'm guessing modules, particularly CGI but would appreciate a

Is there a simple way to include source code I've written in other files?

2003-07-17 Thread Jamie Risk
Until now, I've avoided writing modules by inlining the deisred code in the new files. Messy. I'm avoiding modules for two reasons, laziness and naive conception that for what I'm trying to do it's overkill. Is there a method to reference code in other files, like, a simple include? -- To

Substiuting portions of a string with elements from a hash ...

2003-07-17 Thread Jamie Risk
I'm trying to add HTML anchors to a lines of text. Quick example would be to take the line: Search the internet using an engine like Google. and turn it into: Search the internet using an engine like a href=www.google.comGoogle/a. In the past, I've contructed hash tables from text files

chomp'ing EOL

2003-07-17 Thread Jamie Risk
I've no control over the EOL of text files that I'm processing; is there a conveniant method using chomp() and the INPUT_RECORD_SEPERATOR ($/) to handle DOS/UNIX/MAC generated text files automatically? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Creating html source ...

2003-07-16 Thread Jamie Risk
I have to assume that any of the simple HTML-izing I want to do with simple text files has already been done. I'm guessing modules, particularly CGI but would appreciate a directed pointer to docs. - Jamie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Looking for elegance ...

2003-07-10 Thread Jamie Risk
It's been my experience that readers of this group relish a demonstration of their persnicketiness. For this I give the following; it works, but doesn't appeal to me: my @tmp_list; my @list; my $description; push @tmp_list, split(/\t/,$_,6); push @list, $tmp_list[0],

Re: Looking for elegance ...

2003-07-10 Thread Jamie Risk
Thanks, pleasingly simple. CHOOSE ONE (untested). # # list slice (v. ugly) # my ($desc, @list) = (split /\t/, $_, 6)[4,0..3,5]; # # splice # my @list = split (/\t/, $_, 6); my $desc = splice(@list, 4, 1); -- To unsubscribe, e-mail:

Re: Looking for elegance ...

2003-07-10 Thread Jamie Risk
Your response is a fascinating example of the word! ;) Rob Dixon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Jamie. Jamie Risk wrote: It's been my experience that readers of this group relish a demonstration of their persnicketiness. pernickety adj

Passing file handles to sub-routines ...

2003-07-10 Thread Jamie Risk
I'm a casual PERL programmer at best, and I have a working facsimile of the non-working code below. When I run it, I get an error print() on closed filehandle $fh at ./test.pl line [n]. This is just my first step to being able to pass file handles to my sub-routines. What have I missed? open

Re: Looking for elegance ...

2003-07-10 Thread Jamie Risk
I think we can safely assume that Jamie meant the other definition... Alas, that's true. Good thing people gave me the benefit of the doubt. All sorts of useful information comes from asking a question on this group! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

How does one print blocks of text ..

2003-02-06 Thread Jamie Risk
... without encapsulating each line in double quotes? I've seen this, and don't know where. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Quoted and unquoted spilts

2003-02-06 Thread Jamie Risk
How would I split, then push onto a list a variable length text string with quoted portions (example following) so that a split keeps text in quotes together. keep me together separate1 separate2 separate3 keep me together too separate4 If the above were parsed, I should like to see six

Re: Quoted and unquoted spilts

2003-02-06 Thread Jamie Risk
Never mind, although perhaps someone can explain what split(/''/) is doing. It satisfies my needs, but I don't know why (emphasis on the '' bit between the / /). -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Unix vs DOS EOL ...

2003-02-06 Thread Jamie Risk
Okay, I do know that binary transfer of a text file between DOS and Unix systems is a non-non, but my Samba setup isn't that discriminating. Perl is running on a Unix platform, and 'chomp' isn't quite up to the task of removing CR (ASCII '\r' or 0x0D). So I tried: s/(.+)[ \t\n\r]*/$1/ but those

Re: Unix vs DOS EOL ...

2003-02-06 Thread Jamie Risk
So I tried: s/(.+)[ \t\n\r]*/$1/ but those tricky little CR are still there. Even s/(.+)[ \t\n\r\015]*/$1/ still eludes me. And then I tried: s/([^\n\r]+)[ \t\n\r]*$/$1/; which does work, but seems overly finicky to get rid of BG's legacy. Is there a better way? -- To unsubscribe,

including subroutines from other files ...

2003-02-04 Thread Jamie Risk
How does one do this? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

How do I pass a file handle to a subroutine?

2003-01-31 Thread Jamie Risk
The question stems from the fact that I don't really know what 'type' a file handle is; and I'm also confused about what open FILEHANDLE does as opposed to, open FILEHANDLE, $my_file - Jamie (@21 hours of PERL and counting) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: How do I pass a file handle to a subroutine?

2003-01-31 Thread Jamie Risk
Thanks. Knowing where to find the information is usually more than half the battle; I appreciate the 'perldoc' references as well as your precis. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

How do I get simple random numbers?

2003-01-31 Thread Jamie Risk
I'm looking around, and I see Quantum::Entanglement which looks like overkill; I'd like to generate, 8/16/32 bit random numbers. - Jamie -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How do I get simple random numbers?

2003-01-31 Thread Jamie Risk
I'm thinking I could open up /dev/urandom/ but that hardly seems portable. Jamie Risk [EMAIL PROTECTED] wrote in message b1enfr$evm$[EMAIL PROTECTED]">news:b1enfr$evm$[EMAIL PROTECTED]... I'm looking around, and I see Quantum::Entanglement which looks like overkill; I'd like to genera

creating hash from name/value found in file.

2003-01-29 Thread Jamie Risk
Okay, it's 5:25pm and I started programming PERL shortly after downloading the 5.8.0 tarballs at 2:30pm. I'd like to create a hash from a text file that has name/value pairs, one per line. So far, I'm only capable of reading it in as a list - this PERL stuff really seems easy - but can I (excuse

Re: creating hash from name/value found in file.

2003-01-29 Thread Jamie Risk
Thanks, Timothy, I almost had it before I decided to look back at the list. My only concern was the creation of data space for each new key, I guess it's a non issue. ALTHOUGH, if I have repetitions of keys, code below would obliterate previous key data, would it not? I guess I'm looking at a hash

Re: creating hash from name/value found in file.

2003-01-29 Thread Jamie Risk
Original Message- From: Jamie Risk [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003 3:03 PM To: [EMAIL PROTECTED] Subject: Re: creating hash from name/value found in file. Thanks, Timothy, I almost had it before I decided to look back at the list. My only concern was the