[11696] in Perl-Users-Digest
Perl-Users Digest, Issue: 5296 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 4 21:06:01 1999
Date: Sun, 4 Apr 99 18:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 4 Apr 1999 Volume: 8 Number: 5296
Today's topics:
Re: $1 is not changed after second search (Ronald J Kimball)
Re: (newbie) matching value from array??? (Tad McClellan)
Re: (newbie) matching value from array??? (Larry Rosler)
ActiveState: Commands Using BackQuotes Do not work (NT4 molariu@usa.net
Re: ActiveState: Commands Using BackQuotes Do not work (Bill Moseley)
Counting spaces in a variable <indexfinger@usa.net>
Re: Counting spaces in a variable <rick.delaney@home.com>
Re: Counting spaces in a variable <indexfinger@usa.net>
Re: Counting spaces in a variable <debot@xs4all.nl>
Re: Counting spaces in a variable <rick.delaney@home.com>
Re: Counting spaces in a variable <indexfinger@usa.net>
Re: Counting spaces in a variable (Tad McClellan)
Re: Counting spaces in a variable <rick.delaney@home.com>
Re: Counting spaces in a variable <droby@copyright.com>
Re: Counting spaces in a variable (Larry Rosler)
Re: Database utilisation in web site design <mark@poffenberger.com>
Re: Debugger has problems with forking programs. (Peter Rowell)
Not stupid anymore (Rob Sweet)
Re: Regular Expression Practice (Andrew Johnson)
Re: Regular Expression Practice (Tad McClellan)
Re: Regular Expression Practice (Ilya Zakharevich)
Re: RTC Room (an Answer) <gp@gpcentre.net>
Re: Silicon Valley Perl Mongers? (Ronald J Kimball)
Re: Silicon Valley Perl Mongers? <rick.delaney@home.com>
Re: Split with 2 characters <rick.thomas@ibm.net>
Re: Split with 2 characters <jeffp@crusoe.net>
Trimming a number to only 2 decimal places hogringer@earthlink.net
Re: Trimming a number to only 2 decimal places (Rob Sweet)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 4 Apr 1999 15:05:28 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: $1 is not changed after second search
Message-Id: <1dpqrnb.j95b1h1n14x8gN@p89.tc3.state.ma.tiac.com>
Karsten Patzwaldt <kpa@gmx.net> wrote:
> for(my $i=0; $i <= $#log; $i++) {
> if($log[$i] =~ /([A-Z][a-z]{2} {1,2}[0-9]{1,2} [0-9:]{8}) snerf \
> pppd\[[0-9]{1,5}\]: remote IP address $remote/) {
> $starttime=str2time($1); print "Startzeit: $1\n";
> until($log[$i] =~ /([A-Z][a-z]{2} {1,2}[0-9]{1,2} [0-9:]{8}) snerf \
> pppd\[[0-9]{1,5}\]: Connection terminated./) { $i++; print "Endzeit: $1\n"; }
> $endtime=str2time($1);
> $time+=$endtime-$starttime;
> }
> }
> Do you have any ideas why $1 isn't changed after the second search?
You print $1 each time the second match fails. As documented, $1 et al.
are only set by a _succcesful_ match. There's no point in printing $1
again after an unsuccessful match.
When the match succeeds, you exit the until loop, and $1 now has its new
value. Try moving the 'print "Endzeit: $1\n";' statement to just after
the until loop, and you should see the new value of $1.
Note the use of /x to split the long regexes over multiple lines. The
empty comments are there to make it clear that \ is followed by a space,
not a newline.
for(my $i=0; $i <= $#log; $i++) {
if ($log[$i] =~
/([A-Z][a-z]{2}\ {1,2}[0-9]{1,2}\ [0-9:]{8})\ #
snerf\ pppd\[[0-9]{1,5}\]:\ remote\ IP\ #
address\ \Q$remote/x)
{
$starttime=str2time($1);
print "Startzeit: $1\n";
until ($log[$i] =~
/([A-Z][a-z]{2}\ {1,2}[0-9]{1,2}\ [0-9:]{8})\ #
snerf\ pppd\[[0-9]{1,5}\]:\ Connection\ #
terminated\./x)
{
$i++;
# the match failed; $1 will not have changed
}
# the match succeeded; $1 will have a new value
print "Endzeit: $1\n";
$endtime=str2time($1);
$time+=$endtime-$starttime;
}
}
--
#!/usr/bin/sh -- chipmunk (aka Ronald J Kimball)
perl -s -e'print sort grep {/ \s /x} keys%main::
' -- -is -' Just' -' another ' -'Perl ' -'hacker
' http://www.tiac.net/users/chipmunk/ [rjk@linguist.dartmouth.edu]
------------------------------
Date: Sun, 4 Apr 1999 11:44:26 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: (newbie) matching value from array???
Message-Id: <qc18e7.g1p.ln@magna.metronet.com>
Jerry (preeper@cts.com) wrote:
: I'm hoping that I'm describing this problem pretty clearly.
I fear that is a misplaced hope :-(
: I'm
: having a problem figuring out how to match a value in one column of an
: array where the value of another column in the same array equals a
: value that constantly changes
: For example, I have an array that includes name and link columns and
: is fetched from a MySQL query like so:
: $sql_query = "select city,short_name,full_name,url_link ";
: $sql_query .= "from $linktable";
: $sql_result = $dbh->Query($sql_query);
: while (@row = $sql_result->FetchRow()) {
: $link_city = $row[0];
: $link_short_name = $row[1];
: $link_full_name = $row[2];
: $url_link = $row[3];
: }
That is a cumbersome way to load up your variables.
You can shorten the body of the while loop to a single line:
($link_city, $link_short_name, $link_full_name, $url_link) = @row;
: As part of output of another routine, I print table rows of data and
: some of the items in the row ($name1 and $name2) will match items from
: the link array above. This data is fetched from another table in the
: same MySQL database.
: What I want to do is be able to make $name1 and $name2 hyperlinks only
: if there is a item in the link column from the first array where the
: name from the second one matches a name from the first one.
: I'm completely lost, but trying hard.
Me too. I do not understand the question, and have no code
that I can run.
Try divorcing yourself from your real SQL environment.
Make a small and complete sample program that just loads
up the arrays, then describe in terms of the sample
program what it is that you want to accomplish.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 4 Apr 1999 17:08:53 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: (newbie) matching value from array???
Message-Id: <MPG.11719eea9ce49da698982c@nntp.hpl.hp.com>
In article <qc18e7.g1p.ln@magna.metronet.com> on Sun, 4 Apr 1999
11:44:26 -0400, Tad McClellan <tadmc@metronet.com> says...
> Jerry (preeper@cts.com) wrote:
...
> : $sql_query = "select city,short_name,full_name,url_link ";
> : $sql_query .= "from $linktable";
> : $sql_result = $dbh->Query($sql_query);
> : while (@row = $sql_result->FetchRow()) {
> : $link_city = $row[0];
> : $link_short_name = $row[1];
> : $link_full_name = $row[2];
> : $url_link = $row[3];
> : }
>
>
> That is a cumbersome way to load up your variables.
>
> You can shorten the body of the while loop to a single line:
>
> ($link_city, $link_short_name, $link_full_name, $url_link) = @row;
Which overwrites those variables each time through the loop, so their
values on loop exit are those of the last iteration. That *may* be what
is wanted, but I doubt it.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 04 Apr 1999 21:41:19 GMT
From: molariu@usa.net
Subject: ActiveState: Commands Using BackQuotes Do not work (NT4-IIS4.0)
Message-Id: <7e8m9u$9ht$1@nnrp1.dejanews.com>
Configuration:
==============
WinNT 4.0
Option Pack 4.0
ActiveState 5.005_03 build 513 (also tried with other versions, same result)
The registry contains under HKEY_LOCAL_MACHINE/SYSTEM/../Parameters
a double word variable: CreateProcessWithNewConsole = 1
Problem:
========
Perl scripts invoking user-written programs or external system commands do not
work when invoked as a cgi script while Scripts containing internal system
commands do work fine. For example:
$var = `cal.exe 04 1999`; print $var;
does display the calendar of April 1999 when invoked from the command line but
does not display anything in the browser;
while
$var = `dir `; print $var;
displays the directory both when invoked from the command line or through the
browser.
There are two solutions that I found: 1- using perl.exe from MKS Tools
(without installing the whole MKS Tools package) after I made proper changes
for selecting the correct path for this MKS perl.exe application; 2- instead
of using backquotes I used "system" and redirected the output to a file; then
writing the file content to the browser, line by line.
Unfortunately none of these solutions works practically (because I do not have
a license from MKS and for security purposes).
QUESTION: Had anybody had a similar experience with ActiveState PERL product?
Does it work in your case? I would really appreciate any response or
suggestions/solution to this problem.
Many thanks,
Mihai.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 4 Apr 1999 15:27:55 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: ActiveState: Commands Using BackQuotes Do not work (NT4-IIS4.0)
Message-Id: <MPG.1171874ac71d2659989708@206.184.139.132>
In article <7e8m9u$9ht$1@nnrp1.dejanews.com>, molariu@usa.net says...
> $var = `cal.exe 04 1999`; print $var;
> does display the calendar of April 1999 when invoked from the command line but
> does not display anything in the browser;
>
> while
>
> $var = `dir `; print $var;
> displays the directory both when invoked from the command line or through the
> browser.
What does $? return? Anything in the server log>
Running from the command line but not from the browser would mean a
different environment and perhaps different path. I'm just guessing, but
those are the things I'd try first.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Sun, 04 Apr 1999 21:22:57 GMT
From: "IndexFinger.com" <indexfinger@usa.net>
Subject: Counting spaces in a variable
Message-Id: <RKQN2.137$xI5.5165@typhoon.nycap.rr.com>
What is the function to count the number of spaces in a variable?
Example: "This is an example variable"
In the example, there are 4 spaces.
--
==================================================
BigTalker - http://www.bigtalker.com
Bulletin board software - faster than the UBB
------------------------------
Date: Sun, 04 Apr 1999 21:32:11 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Counting spaces in a variable
Message-Id: <3707DC5E.E8E7FF84@home.com>
[posted & mailed]
IndexFinger.com wrote:
>
> What is the function to count the number of spaces in a variable?
perldoc perlfaq4
How can I count the number of occurrences of a substring within a
string?
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 04 Apr 1999 21:35:54 GMT
From: "IndexFinger.com" <indexfinger@usa.net>
Subject: Re: Counting spaces in a variable
Message-Id: <_WQN2.244$zE3.5248@typhoon.nycap.rr.com>
> perldoc perlfaq4
Where is this document?
--
==================================================
SuggestSite - http://www.suggestsite.com
Word of mouth is the most powerful marketing tool.
------------------------------
Date: Mon, 05 Apr 1999 00:51:08 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: Counting spaces in a variable
Message-Id: <3707ECDC.7DC3A554@xs4all.nl>
I think this should work:
my $count = () = $string =~ /\s/g
"IndexFinger.com" wrote:
> What is the function to count the number of spaces in a variable?
>
> Example: "This is an example variable"
>
> In the example, there are 4 spaces.
>
> --
> ==================================================
> BigTalker - http://www.bigtalker.com
> Bulletin board software - faster than the UBB
--
\\\|///
\\ - - //
( @ @ )
/----------------------oOOo-(_)-oOOo--------------------\
| |
| |
| My Email: debot@xs4all.nl |
| Homepages: http://www.searchy.net/ |
| http://www.debot.nl/ppi/ |
| |
| |
\-------------------------------Oooo--------------------/
oooO ( )
( ) ) /
\ ( (_/
\_)
------------------------------
Date: Sun, 04 Apr 1999 23:15:04 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Counting spaces in a variable
Message-Id: <3707F47B.B174606C@home.com>
[posted & mailed]
IndexFinger.com wrote:
>
> > perldoc perlfaq4
>
> Where is this document?
If you have perl then it's on your harddrive. Most platforms allow you
to type
perldoc perl
at a command line. perldoc is just a tool to allow you to read the
*.pod documents that reside in the pod directory of your perl
installation. There are other tools as well that will convert these
documents to html, etc. They have names like pod2html and also reside
in your perl lib directory.
In some installations this conversion has already been done for you so
you can just search for a file called perl.html if you like to read
documents in html.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 04 Apr 1999 23:37:06 GMT
From: "IndexFinger.com" <indexfinger@usa.net>
Subject: Re: Counting spaces in a variable
Message-Id: <CISN2.251$zE3.5638@typhoon.nycap.rr.com>
Does this work?
$numberofspaces = 0;
foreach ($foo =~ /\S+/sg) { $numberofspaces++ }
--
==================================================
SuggestSite - http://www.suggestsite.com
Word of mouth is the most powerful marketing tool.
------------------------------
Date: Sun, 4 Apr 1999 13:45:50 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Counting spaces in a variable
Message-Id: <eg88e7.u7p.ln@magna.metronet.com>
IndexFinger.com (indexfinger@usa.net) wrote:
: > perldoc perlfaq4
: Where is this document?
On your hard drive if you have a correct perl installation.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 05 Apr 1999 00:00:26 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Counting spaces in a variable
Message-Id: <3707FF1F.699C2317@home.com>
IndexFinger.com wrote:
>
> Does this work?
>
> $numberofspaces = 0;
> foreach ($foo =~ /\S+/sg) { $numberofspaces++ }
WHWYTI (What happened when you tried it) ?
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Mon, 05 Apr 1999 00:05:52 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: Counting spaces in a variable
Message-Id: <7e8uor$gkd$1@nnrp1.dejanews.com>
In article <_WQN2.244$zE3.5248@typhoon.nycap.rr.com>,
"IndexFinger.com" <indexfinger@usa.net> wrote:
> > perldoc perlfaq4
>
> Where is this document?
>
Probably on your system. Try that command and see what you get. All Perl
FAQs and other standard docs are also online at http://www.perl.com along
with lots of other good stuff.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 4 Apr 1999 17:21:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Counting spaces in a variable
Message-Id: <MPG.1171a1dbb50a70b98982d@nntp.hpl.hp.com>
In article <CISN2.251$zE3.5638@typhoon.nycap.rr.com> on Sun, 04 Apr 1999
23:37:06 GMT, IndexFinger.com <indexfinger@usa.net >says...
>
> Does this work?
What an odd question. Does your perl installation not function
correctly, so you are unable to find out for yourself before posting it?
> $numberofspaces = 0;
> foreach ($foo =~ /\S+/sg) { $numberofspaces++ }
Well, it *almost* works, doesn't it? (And it would *almost* work just
as well without the superfluous 's' modifier.)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 4 Apr 1999 16:17:44 -0400
From: "Mark Poffenberger" <mark@poffenberger.com>
Subject: Re: Database utilisation in web site design
Message-Id: <7e8hhb$hp7$1@bgtnsc01.worldnet.att.net>
I must caution that MS extensions does not equal ASP. Quiz the host and see
if they really do have ASP Installed. More then likely they do not, since
it looks like from what you describe it is a Unix host - unless they have
Chili asp installed..
Several things to note:
1) Unless your provider supports MS Access, File maker pro and others that
were mentioned, you would be wasting your time doing anything with them.
2) Since you mention that you have no experience with dB's (excluding MS
Access) you would be looking at a rough time to go through and learn any dB.
Especially since you would have to use some kind of server side language to
interact with the data.
In summary you would be looking at learning the dB, learning some kind of
server side language, setting up the structure of the dB, and then
extracting that info to form your web pages. Tough task for someone that
has no experience in any of the above. Your best bet would be to set-up
templates in Dreamweaver, and then just enter the info in by hand. Another
option would be to find a friend that could do the above - hopefully at a
nominal charge (can we say FREE)
Wish you luck.
Mark
Greg Griffiths wrote in message <370154E4.B5252696@surfaid.org>...
>I too would go with msql ,which is a very good little database, although
>if they are providing you wiht MS extensions then perhaps a quick look
>at Active Server Pages, as you are not very experienced, judging from
>your posting then using a lot of Perl or Python to interact with a DB is
>probably a bit too much, I suggest that you investigate the ASP roiute
>first and then the mSQL, and also talk to your ISP and see what help
>they can be.
>
>liu singloon wrote:
>>
>> Hi need some info and advice on the following,
>>
>> I have recently signed up with a paid web hosting provide and registered
my
>> own domain name.
>>
>> My web host package supports the following:
>>
>> SSI, Server Side Support for Java, PERL 4, 5, 5.003, 5.004, C++, TCL, and
>> Python, IMAP4 and Procmail. mySQL 2.0.3 AND 3.22
>>
>> and
>>
>> Support For MS Frontpage 97 and 98 Extensions and HTML Script Applets and
>> Miva Mia ?.
>>
>> What I want to do is be able to easily update my entertainment web sites
>> movie release dates listing and to generate a html file which I have
>> designed around my web site layout etc. It can be generated offline and
I
>> can upload it or can be done on the fly.
>>
>> The site will be divided among 2 -7 countries = each with categories
listed
>> by month from Jan - Dec - showing release dates for that country.
>>
>> I have no experience with databases - apart from my 1 single uni subject
on
>> Access 2 which I have little memory of.
>>
>> My current set of design tools are,
>>
>> Dreamweaver 1.2/2, Homesite 3/4, Adobe Pagemaker, Adobe Photoshop 4.01,
>> Fireworks 1, Flash 3, GIF Movie Gear 2.6, MS GIF Animator and WS_FTP LE
and
>> Pro 6.
>>
>> Does anyone know of some programs that will allow me to
>>
>> 1. Create an easy to use database ? - I have Access 7 but don't know much
>> about it.
>> 2. Generate custom designed html files for database data on movie release
>> dates ?
>>
>> I tried Drumbeat 2000 evaluation but it crashes my pc and stalls ....
>>
>> Thanks, my current web site is below, but will be moving to the new paid
web
>> host hopefully by the end of the month or middle of next month.
>>
>> --
>> George Liu
>>
>> =====================================
>> http://georges-place.webjump.com/
>> - Australian/US/HK movie release dates
>> - Oscars, Movies, Trailers & Info for 1999
>> - Oscars Winners List
>> =====================================
------------------------------
Date: 4 Apr 1999 13:02:12 -0700
From: thirdeye@sonic.net (Peter Rowell)
Subject: Re: Debugger has problems with forking programs.
Message-Id: <7e8gg4$n2c@bolt.sonic.net>
In article <7e8bm5$kmu@bolt.sonic.net>,
Peter Rowell <thirdeye@sonic.net> wrote:
>WARNING: Speculation follows ...
Oops. I misread the description of the problem. Never mind.
Peter
------------------------------
Date: Sun, 04 Apr 1999 19:07:53 GMT
From: sweet@enterpriseusa.com (Rob Sweet)
Subject: Not stupid anymore
Message-Id: <3707b72d.5004787@news.msen.com>
Thanks to all who posted. I took Bob's advice to "Take a deep breath
and relax,", and realized that as Ran says, from the point of view of
the server, there is no difference between POSTING direct to the
underlying CGI vs. "remote controling" the web page. Duh. The web
page runs on MY WORKSTATION. That realization was what turned the
light on.
In my defense, I'm not normally an idiot.... er... well, anyway. The
web admin at the destination had misled me, claiming that their site
wouldn't work if I posted direct to the CGI. Obviously I *CAN* post
direct to the CGI, since any HTML form is running on my server, and
the target CGI has no idea what is generating the post.
My true idiocy, for which I deserve a good slap, is that I believed a
client without thinking it through ... and to think I call myself a
professional.
On Sun, 04 Apr 1999 02:49:42 GMT, ran@netgate.net (Ran) wrote:
>From the point of view of the underlying client-server code, those
>actions are identical.
------------------------------
Date: Sun, 04 Apr 1999 20:15:32 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Regular Expression Practice
Message-Id: <ELPN2.2517$oQ2.14848@news.rdc1.on.wave.home.com>
In article <37078994.6AFDD21B@home.com>,
Kenneth Rose <kenrose@home.com> wrote:
! Hi all,
!
! OK, I'm learning regular expressions and I'm hooked...I love this stuff!
! Very powerful stuff! Now, what I'd like from you experts in the Perl
! community are some mini exercises that could be done in regular
! expressions. e.g. using regular expressions, create a titler (that is,
! makes the first character of every word capitalized). The solution to
! this would be:
perlfaq4.pod: How do I capitalize all the words on one line?
! That's the first thing. Next, is a problem which is as follows. I have
! an n digit number. I would like to, starting from the right side, place
! a comma every 3rd digit. I have this solution so far:
perlfaq5.pod: How can I output my numbers with commas added?
regards
andrew
------------------------------
Date: Sun, 4 Apr 1999 11:06:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regular Expression Practice
Message-Id: <j5v7e7.g1p.ln@magna.metronet.com>
Kenneth Rose (kenrose@home.com) wrote:
: OK, I'm learning regular expressions and I'm hooked...I love this stuff!
: Very powerful stuff! Now, what I'd like from you experts in the Perl
: community are some mini exercises that could be done in regular
: expressions. e.g. using regular expressions, create a titler (that is,
: makes the first character of every word capitalized). The solution to
: this would be:
: s/(\w+)/\u$1/sg;
The correct solution would not use options that cannot have
any effect. It slows down understanding of the code, which
is bad for maintenance.
s///s option affects _only_ the interpretation of the dot character.
It is a red herring to use it when your regex does not even
have a dot in it.
s/(\w+)/\u$1/g;
: That's the first thing. Next, is a problem which is as follows. I have
: an n digit number. I would like to, starting from the right side, place
: a comma every 3rd digit. I have this solution so far:
What do you find lacking in the answer to that
Frequently Asked Question? (search for "commas" in the Perl FAQ)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 4 Apr 1999 23:00:13 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Regular Expression Practice
Message-Id: <7e8qtt$41t$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tad McClellan
<tadmc@metronet.com>],
who wrote in article <j5v7e7.g1p.ln@magna.metronet.com>:
> s///s option affects _only_ the interpretation of the dot character.
It would be nice if categoric statements like this one were also true.
There are additional side-effects of //s : it switches off effects of
the deprecated $* variable, thus it *may* affect also '^' and '$'.
(This is relevant very rare indeed, and also has no relation
whatsoever to the example you discuss.)
Ilya
------------------------------
Date: Sun, 04 Apr 1999 16:33:40 -0600
From: Philip Gabbert <gp@gpcentre.net>
Subject: Re: RTC Room (an Answer)
Message-Id: <040419991633409125%gp@gpcentre.net>
Well.. I found my answer myself, aint that the way it should be..
Okay.. Well.. it all way from this page:
http://www.icp.kyoto-art.ac.jp/man_perl/lib/CGI/Push.html
Turned out I had to install my script as a Non-Parsed-Header, (ie:
place 'nph-' infront of my script name)
Once I did that, it worked perfect..
thnx for your help.. ;-)
Philip
PS: I figure I post this as information only for people that wish to
know, or might be having the same trouble I am having.
In article <030419991957298294%gp@gpcentre.net>, Philip Gabbert
<gp@gpcentre.net> wrote:
> I'm trying to create a 'real' time chat room. You know one of the ones
> where the frame withthe messages is constantly loading, and printing
> news messages as they appear in the Chat room data file..
>
> I've gotten the script to work like a champ on a Linux system, but I
> can't for the love of me get the script to work via Netscape..
> Any ideas?
> Now, the contast loop in the script will run fine on the command line,
> but Netscape like tries to read the extire script output before ever
> printing anything to the screen.
>
> Is there a way i can 'force' Netscape to print the output as it comes?
> If so how? I'm totally baffeled, and every chat room I can find on CGI
> Resources that's created using Perl costs, and I can't view thier
> source to see how they have done it..
>
> Can Anybody help? I'm really lost?
>
> Thanx..
>
> Philip
>
> PS: If you need to see my source code for what i have done, please
> emial me privatly
> PPS: I'm already using the buffer-flushing ($| = 1)
------------------------------
Date: Sun, 4 Apr 1999 15:05:31 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Silicon Valley Perl Mongers?
Message-Id: <1dpqsgy.gi5qpl2z6vi2N@p89.tc3.state.ma.tiac.com>
Ran <ran@netgate.net> wrote:
> From the home office in Alviso, the Top 10 Reasons That There's no Perl
> Mongers Group in Silicon Valley":
>
> 10. Every techie in the Valley has dedicated net access, so we do all
> our interpersonal interaction online.
> 7. Perl doesn't *need* to be mongered here.
That was very amusing! But what happened to 8 and 9?
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sun, 04 Apr 1999 20:24:35 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Silicon Valley Perl Mongers?
Message-Id: <3707CC85.B28BBC27@home.com>
Ronald J Kimball wrote:
>
> Ran <ran@netgate.net> wrote:
>
> > From the home office in Alviso, the Top 10 Reasons That There's no Perl
> > Mongers Group in Silicon Valley":
> >
> > 10. Every techie in the Valley has dedicated net access, so we do all
> > our interpersonal interaction online.
> > 7. Perl doesn't *need* to be mongered here.
>
> That was very amusing! But what happened to 8 and 9?
In Silicon Valley they all count in octal.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 04 Apr 1999 14:19:29 -0600
From: Rick Thomas <rick.thomas@ibm.net>
To: Frank de Bot <debot@xs4all.nl>
Subject: Re: Split with 2 characters
Message-Id: <3707C951.87D7B8FF@ibm.net>
Frank de Bot wrote:
>
> Is there a way to split a string with 2 characters.For example:
>
> $string = "<font size=2>Hi World</font><br>";
>
> $array[0] = "font size=2"
> $array[1] = "Hi World"
> $array[2] = "/font"
> $array[3] = "br"
>
> Splitting by "<" and ">"
>
> OR... You can give me a CLEAR example of the module HTML::HeadParser .
> (Don't say that I must look at the html document that are included with
> perl, because the example are full of bugs en the I don't understand the
> description.
>
> --
> My Email : debot@xs4all.nl
> Homepages : - http://www.debot.nl/ppi/
> - http://www.searchy.net/
Here's a special-case solution:
my $string = '<font size=2>Hi World</font><br>';
my @array = ();
push @array, $1 while $string =~ /[<>]?([^<>]+)/g;
print join "\n", @array;
------------------------------
Date: Sun, 4 Apr 1999 16:22:06 -0400
From: evil Japh <jeffp@crusoe.net>
Subject: Re: Split with 2 characters
Message-Id: <Pine.GSO.3.96.990404162041.13628A-100000@crusoe.crusoe.net>
> Is there a way to split a string with 2 characters.For example:
>
> $string = "<font size=2>Hi World</font><br>";
>
> $array[0] = "font size=2"
> $array[1] = "Hi World"
> $array[2] = "/font"
> $array[3] = "br"
>
> Splitting by "<" and ">"
Sure. After reading the documentation for split, you see that the first
argument is a regular expression defining the splitting character(s).
Thus, trying: @array = split /<|>/, $var; will do what you want.
Verify that by reading:
1) man perlfunc
or 2) perldoc perlfunc
or 3) perldoc -f split
--
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp
Crusoe Communications, Inc.
732-728-9800
www.crusoe.net
------------------------------
Date: Sun, 04 Apr 1999 22:44:49 GMT
From: hogringer@earthlink.net
Subject: Trimming a number to only 2 decimal places
Message-Id: <3709ea06.5727574@news.earthlink.net>
Can someone tell me how to trim a dollar amount to just 2 decimal
places? I want to print "Federal tax is $xxx.xx" and I get a number
with 6-8 numbers to the right of the decimal. I tried using %.2f but
I must not be using it right because it wont display right. I have a
line that reads
$ftax = ($gross*.10);
and then it is displayed with this line
print " | Federal tax is \$$ftax
I would like to get rid of all the extra digits. Can someone help me
with this? Thanks
Gary
------------------------------
Date: Sun, 04 Apr 1999 19:11:12 GMT
From: sweet@enterpriseusa.com (Rob Sweet)
Subject: Re: Trimming a number to only 2 decimal places
Message-Id: <3707b91e.5502297@news.msen.com>
You realize that if you're going to use %f you've gotta use printf not
print, right? Just a quick thought...
Rob Sweet
sweet@enterpriseusa.com
On Sun, 04 Apr 1999 22:44:49 GMT, hogringer@earthlink.net wrote:
>Can someone tell me how to trim a dollar amount to just 2 decimal
>places? I want to print "Federal tax is $xxx.xx" and I get a number
>with 6-8 numbers to the right of the decimal. I tried using %.2f but
>I must not be using it right because it wont display right. I have a
>line that reads
>
>$ftax = ($gross*.10);
>
>and then it is displayed with this line
>
>print " | Federal tax is \$$ftax
>
>I would like to get rid of all the extra digits. Can someone help me
>with this? Thanks
>
>Gary
>
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5296
**************************************