Re: Newbie about

2002-07-13 Thread Connie Chan
> > I'm curious about your system too. > > > For me, Win32, ( Me / 98 ) > I will use chop, like > > chop($input); # Kill whatever the last char at a line > > On Win32, the line terminator is usually "\015\012", or CRLF. Of > course, the file you are reading may not have the usual endings for t

Re: script too slow?

2002-07-13 Thread Paul Tremblay
On Sat, Jul 13, 2002 at 10:57:04PM -0400, Tanton Gibbs wrote: > > > I'm not exactly sure what the problems are; however, here are a couple of > things to try > 1.) If you don't need to save the value of each of the subexpressions, then > tell perl so by using ?: after each opening paren. Once I

Re: File positions and seek

2002-07-13 Thread Connie Chan
Sorry that I am not good in English , so dunno what do you want exactly =) But after in view of your code, it seem that you 've doing something wrong, maybe... I don't know.. So let's check it out =) > > ---Code Snip > > open (IN, "tst.txt) or die "Cannot open $file for read :$!"; > > m

Re: script too slow?

2002-07-13 Thread Paul Tremblay
On Sat, Jul 13, 2002 at 08:08:50PM -0700, Marco Antonio Valenzuela Escárcega wrote: > Subject: Re: script too slow? > > > maybe you should check this out: > http://search.cpan.org/search?dist=RTF-Tokenizer > http://search.cpan.org/search?dist=RTF-Parser > > These modules could be exactly what I

Re: script too slow?

2002-07-13 Thread Marco Antonio Valenzuela Escárcega
maybe you should check this out: http://search.cpan.org/search?dist=RTF-Tokenizer http://search.cpan.org/search?dist=RTF-Parser On Sat, 2002-07-13 at 19:35, Paul Tremblay wrote: > I just finished my first version of a script that converts rtf to > xml and was wondering if I went about writing it

Re: script too slow?

2002-07-13 Thread Tanton Gibbs
I'm not exactly sure what the problems are; however, here are a couple of things to try 1.) If you don't need to save the value of each of the subexpressions, then tell perl so by using ?: after each opening paren. 2.) Usually alternation is much slower than doing separate regexes...however, in yo

File positions and seek

2002-07-13 Thread Dave Chappell
I am trying to use the seek function to force where my second while loop starts within file tst.txt but I see the $. Gets reset to 0 before while () starts. My ultimate goal for this script is when a web page loads on my site. The script executes, reads portions of tst.txt that have changed s

script too slow?

2002-07-13 Thread Paul Tremblay
I just finished my first version of a script that converts rtf to xml and was wondering if I went about writing it the wrong way. My method was to read in one line at a time and split the lines into tokens, and then to read one token at a time. I used this line to split up the text: @tokens =

Re: Newbie about

2002-07-13 Thread Paul Johnson
On Sat, Jul 13, 2002 at 06:14:34PM +0800, Connie Chan wrote: There seems to be something fishy with your system or the files you are using. > May I ask what kind of system you are using ? I'm curious about your system too. > For me, Win32, I will use chop, like > chop($input); # Kill whatever

Re: Newbie about

2002-07-13 Thread Simon K. Chan
Hi Mark, the "chomp" function will take care of that problem for you. "chomp" removes carriage returns, if any, from the input. you might have also heard of "chop" which removes the last character of a string, which may or may not be a return. So, use "chomp" instead. #!/usr/local/bin/pe

Re: teaching examples (was "Re: Date and Time")

2002-07-13 Thread drieux
On Saturday, July 13, 2002, at 07:11 , David T-G wrote: In the main I like where this is generally going. A part of my argument with myself today has been about which is better? all 'teaching code' should be 'virgin clean'??? or should we show the actual process by which ideas

Re: A localtime question

2002-07-13 Thread Steve
Thanks That worked perfectly. On Saturday 13 July 2002 17:50, George Schlossnagle wrote: > do > > $date = sprintf("%04d%02d%02d", $year,$mday,$mon); > > btw, ddmm is not sortable, you may want to use mmdd. > > George > > On Saturday, July 13, 2002, at 05:38 PM, Steve wrote: > > I have th

Re: A localtime question

2002-07-13 Thread George Schlossnagle
do $date = sprintf("%04d%02d%02d", $year,$mday,$mon); btw, ddmm is not sortable, you may want to use mmdd. George On Saturday, July 13, 2002, at 05:38 PM, Steve wrote: > I have this snippet of code: > > > use warnings; > use strict; > use diagnostics; > my $date; > my $base_url; > my

A localtime question

2002-07-13 Thread Steve
I have this snippet of code: use warnings; use strict; use diagnostics; my $date; my $base_url; my $full_url; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $year+=1900; $date = $year.$mday.$mon; $date is gettin

Re: "require" returns no value ?

2002-07-13 Thread drieux
On Saturday, July 13, 2002, at 10:37 , Connie Chan wrote: [..] > I don't know how to define, I just put them( *.pl files) > all under a folder "myLib" inside /lib/. And those .pl > files are just subs insides, even not "packaged"... so... best then to start calling them 'libraries' as in

Re: "require" returns no value ?

2002-07-13 Thread WyvernGod
and always make sure you have the 1; at the very end of the file you are requireing... ::doesn't know how many times he was up late to discover that was why it would say the file wasn't required:: Chris -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PRO

Re: "require" returns no value ?

2002-07-13 Thread Peter Scott
At 01:37 AM 7/14/02 +0800, Connie Chan wrote: > > As noted you should do the require in an eval block > > so that you can gracefully manage the "oopsies"... > >I don't really know how to, so a stupid way to solve this problem : > >my $libPath = 'C:/perl/lib/myLib/'; >my $script = 'ScriptA.pl'; > >

Re: "require" returns no value ?

2002-07-13 Thread Connie Chan
> while an interesting strategy to make sure that > a stack of perl scripts are there, did you mean > to check for them as 'scripts'? or are you starting > up the curve from perl library to perl modules? I don't know how to define, I just put them( *.pl files) all under a folder "myLib" inside /

Re: get page with IO::Socket , but having trouble saving to file

2002-07-13 Thread drieux
On Saturday, July 13, 2002, at 08:06 , FLAHERTY, JIM-CONT wrote: [..] > unless ($remote) { die "cannot connect to http daemon on $host" } > > $remote->autoflush(1); [..] >print LOG9 " $remote \"GET $document HTTP/1.0\" . $BLANK"; > > while ( <$remote> ) { print LOG9 }

Re: "require" returns no value ?

2002-07-13 Thread drieux
On Wednesday, July 10, 2002, at 03:14 , Connie Chan wrote: [..] > Questions : > 1. How can I know if a "require" is success or not ? > 2. Anything wrong for what I wrote ? counter question: while an interesting strategy to make sure that a stack of perl scripts are there, did yo

Re: get page with IO::Socket , but having trouble saving to file

2002-07-13 Thread Felix Geerinckx
on Sat, 13 Jul 2002 15:06:38 GMT, Jim-Cont Flaherty wrote: > Hello, get page with IO::Socket , but having trouble saving to file > > This is what I got: > [code snipped] > Help , what am I doing Wrong ?? You are trying to reinvent the wheel instead of using LWP::Simple. perldoc LWP::

get page with IO::Socket , but having trouble saving to file

2002-07-13 Thread FLAHERTY, JIM-CONT
Hello, get page with IO::Socket , but having trouble saving to file This is what I got: use IO::Socket; $host = "www.cnn.com"; $document = "/newhomepage1.htm"; foreach $doc ($document) { $remote = IO::Socket::INET->new( Proto => "tcp",

Re: teaching examples (was "Re: Date and Time")

2002-07-13 Thread David T-G
Peter, et al -- ...and then Peter Scott said... % % At 11:18 AM 7/12/02 -0500, David T-G wrote: % > % >...and then Peter Scott said... % >% ... % >% possible. Later on I show the beginners a nasty example of the % >% consequences of leaving out use strict, -w/use warnings, or both. % > % >Oooh!

Re: Zlib compression question

2002-07-13 Thread Shannon Murdoch
Seem to have stated my own solution. $outlog=gzopen($fn,"a"); specifies appendage to a file whereas $outlog=gzopen($fn,"wb"); specifies overwriting a file. Does anyone know how to READ a gzip file into an array? -Shannon > Hi all, > > I'm running a site with a lot of compressed text files c

Zlib compression question

2002-07-13 Thread Shannon Murdoch
Hi all, I'm running a site with a lot of compressed text files containing data for various clients. Some of these files get appended to (lets say, a log file perhaps). Is there some prevision to the Compress:Zlib module that lets you specify that you want to append to a file? (instead of needin

Re: Any warning if I use '03E9' like string as a key in hash ?

2002-07-13 Thread Felix Geerinckx
on Sat, 13 Jul 2002 10:42:23 GMT, Connie Chan wrote: > But what I most consider is that, if I use numeric format as hash > key will cause any error. As long as other programming langs I > learnt, I know var name should not in numeric format, but the > grey zone for me in this case is that I can

Re: out of memory

2002-07-13 Thread Connie Chan
> > Here is the my script which fetch the data from oracle > > while ($data = $sth-> fetchrow ) { So, what is fetchrow doing ? would it cause an infinity loop which making the return value perpair for $data keep growing and finally eat up all your memory ? Beside, is there any argument for fetc

Re: Any warning if I use '03E9' like string as a key in hash ?

2002-07-13 Thread Connie Chan
> > but if it is a simple mapping as you suggest. > > > b855=cdf2 > > a456=d5c9 > > a454=c8fd > > a457=c9cf > > a455=cfc2 > > .. There is one exception, 2020=2020, this pair exist many times. This comming out becaue of either GB have this char, but Big5 have not, or reverse the case.

Re: Newbie about

2002-07-13 Thread Connie Chan
May I ask what kind of system you are using ? For me, Win32, I will use chop, like chop($input); # Kill whatever the last char at a line But if I go on with unix like system, I have to use chomp, like chomp($input); # kill only CR at the end of line. I don't know why, but chomp doesn't take eff

Re: How can I get element location in array ?

2002-07-13 Thread Connie Chan
> Have you considered putting your data in a hash instead of an array? > > -- > felix YES, I do. And so I post another thread for "Any warning if I use '03E9' like string as a key in hash." That is about the story of why I ask that. @array = ('b855=cdf2', 'a456=d5c9', 'a454=c8fd', 'a457=c9cf', '

Re: How can I get element location in array ?

2002-07-13 Thread Felix Geerinckx
on Fri, 12 Jul 2002 21:14:19 GMT, Connie Chan wrote: > Right, I better set $GetLocation = -1, but, what I am looking for > is if there is something working like grep does ? > > @elemLoc = grepIndex (/pattern/, @list); # something like that ? > > And is that I can't aviod to use loop to search f

Re: Newbie about

2002-07-13 Thread Felix Geerinckx
on Sat, 13 Jul 2002 07:30:35 GMT, Mark "Thumper" Weisman wrote: >I've got an easy one probably, however, I can't figure it out. I'm > writing a command line script which asks the user to complete some > simple information. I use the pushing the value into a > variable, however when I got to

Newbie about

2002-07-13 Thread Thumper
Hello List, I've got an easy one probably, however, I can't figure it out. I'm writing a command line script which asks the user to complete some simple information. I use the pushing the value into a variable, however when I got to post the variable to another variable or array, it has a