[11695] in Perl-Users-Digest
Perl-Users Digest, Issue: 5295 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 4 16:05:57 1999
Date: Sun, 4 Apr 99 13:00:17 -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: 5295
Today's topics:
$1 is not changed after second search (Karsten Patzwaldt)
Re: $1 is not changed after second search <jdf@pobox.com>
(newbie) matching value from array??? (Jerry)
Re: Alternative for Perl (Andrew M. Langmead)
Re: Alternative for Perl <jonathan@meanwhile.freeserve.co.uk>
Re: CGI for Online Credit Cards / Local Testing? <zenin@bawdycaste.org>
Re: Debugger has problems with forking programs. (Peter Rowell)
Re: Debugger has problems with forking programs. (Ilya Zakharevich)
Re: Does anyone know how to do date/time functions in P (Bill Moseley)
Get data from textbox's and store for other page [ HELP <matt@gapps.co.uk>
Re: Get data from textbox's and store for other page [ (Gary Wilson)
IIS SMTP and io:socket problem kskvarci@my-dejanews.com
Lisp influences on Perl, Perl as an AI language <jonathan@meanwhile.freeserve.co.uk>
Re: Oracle DBD work-around <rick.delaney@home.com>
Re: Oracle DBD work-around <ffchopin@worldnet.att.net>
Re: Oracle DBD work-around <rick.delaney@home.com>
Re: Oracle DBD work-around (Larry Rosler)
Re: Perlshop (Peter Rowell)
Regular Expression Practice <kenrose@home.com>
Re: Regular Expression Practice <ffchopin@worldnet.att.net>
Re: Silicon Valley Perl Mongers? (brian d foy)
Re: Silicon Valley Perl Mongers? <kperrier@blkbox.com>
Split with 2 characters <debot@xs4all.nl>
Re: Total beginner question (opps) <gp@gpcentre.net>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 4 Apr 1999 15:36:50 +0200
From: kpa@gmx.net (Karsten Patzwaldt)
Subject: $1 is not changed after second search
Message-Id: <slrn7geqni.rnk.kpa@snerf.local>
Hi!
I have the following problem: I'm working on a program that should
analyze my /var/log/messages* by counting the minutes I was connected to
my ISP and telling me how much it will cost. To do this, I search for
the /var/log/messages* files and read them all in one array, @log. Then,
I want to search for the lines "... remote IP address: aaa.bbb.ccc.ddd"
and "...Connection terminated.". To do this, I use the following piece
of code:
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;
}
}
snerf is my hostname, $remote is the IP of my gateway at the ISP and
$starttime and $endtime are the times when the connection began and when
it ended, respectively. You might also see that I'm trying to save the
time of the beginning and the end of the connection by using the '(...)'
expression for the time and reading it from $1 after the appropriate
lines were found. But this is the problem: the second use of $1 gives me
the same result as the first, but the connections were terminated
minutes and hours later! I already made sure that the appropriate lines
are found by using the 'print ...' in the loops.
Do you have any ideas why $1 isn't changed after the second search?
BTW, '\<newline>' is not in the code, it is one line there, I use it
here because slrn doesn't allow more than 80 chars/line.
--
Der groesste Feind des Fortschritts ist nicht der Irrtum, sondern die
Traegheit. -=- Henry Thomas Buckle
OpenPGP Key: 4096 / 4138 97ED 3C83 7D94 44CC 6B25 BD9F C12D 72A1 DE6F
erhaeltlich bei hkp://wwwkeys.de.pgp.net -=- OpenPGP-Mail erwuenscht!
------------------------------
Date: 04 Apr 1999 11:59:47 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: kpa@gmx.net (Karsten Patzwaldt)
Subject: Re: $1 is not changed after second search
Message-Id: <m3lng85qbw.fsf@joshua.panix.com>
kpa@gmx.net (Karsten Patzwaldt) writes:
> Do you have any ideas why $1 isn't changed after the second search?
As documented, $1 is set upon a *successful* match. See perlre.
The scope of $<digit> (and $`, $&, and $') extends to the end
of the enclosing BLOCK or eval string, or to the next
successful pattern match, whichever comes first.
^^^^^^^^^^
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sun, 04 Apr 1999 19:23:27 GMT
From: preeper@cts.com (Jerry)
Subject: (newbie) matching value from array???
Message-Id: <3707b548.12470967@news2.cts.com>
I'm hoping that I'm describing this problem pretty clearly. 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];
}
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.
Jerry
preeper@cts.com
------------------------------
Date: Sun, 4 Apr 1999 17:08:04 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Alternative for Perl
Message-Id: <F9oCxG.E13@world.std.com>
Eric Bohlman <ebohlman@netcom.com> writes:
>Andrew M. Langmead <aml@world.std.com> wrote:
>: Frank de Bot <debot@xs4all.nl> writes:
>: >Is there an other language to replace perl, which is much faster?
>: >Currently I have a database and I think when It's grown bigger, it will
>: >ask too much of my computers capicity.
>: If the code you use to access your data is O(n) or worse, you should
>: re-think the algorithm.
>Even if it's O(1), it's possible that the (1) is too big (for example, a
>Web database application that's implemented on a
>one-database-connection-per-hit basis).
If it takes a constant time, then the problems that Frank is fearing
will occur in in the small datasets he is experimenting with now. He
won't have to wait until it grows bigger.
--
Andrew Langmead
------------------------------
Date: Sun, 4 Apr 1999 19:28:45 +0100
From: "Jonathan" <jonathan@meanwhile.freeserve.co.uk>
Subject: Re: Alternative for Perl
Message-Id: <7e8b1k$7o2$1@news4.svr.pol.co.uk>
Frank de Bot wrote in message <3705182F.22C91229@xs4all.nl>...
>Is there an other language to replace perl, which is much faster?
>Currently I have a database and I think when It's grown bigger, it will
>ask too much of my computers capicity.
Typically, the cost of accessing large data sets is dominated by the cost of
actually fetching data from memory to the L2/L1 cache - even system RAM is
slow compared to these. (I'm assuming that your database fits in RAM or can
be processed in chunks that can easily do so - memory after all is cheap
these days.) Re-writing a database system in another language is unlikely to
help here.
What would help (besides a faster computer - especially one with faster
memory system) is writing a system that uses small key sizes where all the
keys for a specific search type are stored in the same area of memory - see
Dowd's High Performance Computing for more, or Inner Loops (can never
remember the author) for a more Intel C-assembly specific picture. Such a
system will need separate structures for each key.
Jonathan Coupe.
------------------------------
Date: 04 Apr 1999 14:09:52 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: CGI for Online Credit Cards / Local Testing?
Message-Id: <923235059.308001@thrush.omix.com>
[posted & mailed]
Information Services <info@billyjack.com> wrote:
>snip<
: My questions:
: 1. I've written a script to get from order form to review, with totals, but
: how do I next go to payment system with required fields? Does the cgi
: program I wrote to create the review page also make the review page into a
: form itself? (I'm asking because I've tried this and keep getting server
: errors.)
Wrong group. Try comp.infosystems.www.authoring.cgi
: 2. How do pros test? I keep editing, uploading, changing priveleges,
: testing, editing, etc. Is there a better way?
Telnet to the server, twice.
Edit in one window, run "tail -f /path/to/web/error-log" in the
other.
: Is there a way to test the scripts locally on a Mac for those times when
: I'm not online?
Run a web server locally on your Mac. Something like WebTen, a
Mac version of Apache: http://www.webten.com/
--
-Zenin (zenin@archive.rhps.org)
Yah, Emacs is a good OS, but I prefer FreeBSD.
------------------------------
Date: 4 Apr 1999 11:40:05 -0700
From: thirdeye@sonic.net (Peter Rowell)
Subject: Re: Debugger has problems with forking programs.
Message-Id: <7e8bm5$kmu@bolt.sonic.net>
In article <3702667A.167EB0E7@ks.sel.alcatel.de>,
William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de> wrote:
[ snip - description of a perl program that forks a bunch of commands ]
>For breakpoints in the code after the fork, the debugger prints the
>current line and it continues executing - ignoring the keyboard.
WARNING: Speculation follows ...
It may be that STDIN is losing its "TTY" attribute following the fork.
If so, then the following items from "perldoc perldebug" may be relevant:
noTTY If set, goes in NonStop mode, ... etc.
NonStop If set, debugger goes into noninteractive mode
until interrupted ... etc.
>From a quick browse of the source (5.005_03), there are several
indications of signal and IO diddling in the area of a fork.
In pp_sys.c:pp_system() I note "rsignal_save(SIGINT, SIG_IGN, &ihand)"
which probably causes your ^C to be ignored.
I also note (and should have thought of sooner) that in util.c:my_popen()
STDOUT (and maybe STDIN) are redefined to be pipes (read: no longer
command terminal). Soooo, my guess is that managing several processes
via the perl debugger is either (a) not possible, (b) not implemented,
or (c) not working. My bet is that it is a combination of (a) and (b),
depending on how the child was created.
Having implemented a version of this 15 years ago in the CDB debugger, I
can tell you that using a single terminal to debug multiple asynchronous
processes is a bitch. For one thing, it is often somewhat confusing
about which process hit which breakpoint in what order.
One thing you might try, depending on your platform and how your program
works, is to have a "special" system() call that allows you to specify
different pty's for the various processes. For instance, if you are
using xterm's under X, you can fire up half a dozen of them, to a 'tty'
command to see which pty they are attached to, and then do you own "fork,
change STDIN/STDOUT to the pty, exec" (or whatever) and then use each
xterm as a separate debug console. Of course, this loses if you were
trying to capture the child's STDOUT back in the parent.
Frankly, I strongly recommend that you figure out a way to test each
process on its own so that you can avoid this cesspool entirely. When
each is working independently, then you can debug that main logic
loop, knowing that the subcomponents are OK.
HTH,
Peter
peter@thirdeye.com
------------------------------
Date: 4 Apr 1999 19:05:17 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debugger has problems with forking programs.
Message-Id: <7e8d5d$m2$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Peter Rowell
<thirdeye@sonic.net>],
who wrote in article <7e8bm5$kmu@bolt.sonic.net>:
> It may be that STDIN is losing its "TTY" attribute following the fork.
Eh?
Additionally, perldb is not using STDIN.
> If so, then the following items from "perldoc perldebug" may be relevant:
>
> noTTY If set, goes in NonStop mode, ... etc.
>
>
> NonStop If set, debugger goes into noninteractive mode
> until interrupted ... etc.
Again, most probably an obsolete Perl.
> From a quick browse of the source (5.005_03), there are several
> indications of signal and IO diddling in the area of a fork.
> In pp_sys.c:pp_system() I note "rsignal_save(SIGINT, SIG_IGN, &ihand)"
> which probably causes your ^C to be ignored.
Irrelevant. No system() was mentioned. Debugger catches ^C anyway.
> I also note (and should have thought of sooner) that in util.c:my_popen()
> STDOUT (and maybe STDIN) are redefined to be pipes (read: no longer
> command terminal).
Irrelevant.
> Soooo, my guess is that managing several processes
> via the perl debugger is either (a) not possible, (b) not implemented,
> or (c) not working. My bet is that it is a combination of (a) and (b),
> depending on how the child was created.
Wrong.
> Having implemented a version of this 15 years ago in the CDB debugger, I
> can tell you that using a single terminal to debug multiple asynchronous
> processes is a bitch. For one thing, it is often somewhat confusing
> about which process hit which breakpoint in what order.
This is correct/relevant as far as one terminal is concerned. But perldb
will use multiple terminals if possible.
Ilya
------------------------------
Date: Sun, 4 Apr 1999 07:37:17 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Does anyone know how to do date/time functions in Perl
Message-Id: <MPG.117118fc53da2ddc989707@206.184.139.132>
In article <7e72ff$1kg$1@nnrp1.dejanews.com>, agniora@usa.net says...
> I looked in the FAQ and the CPAN, but the modules i need seem to be for Unix
> only, but im running perl for NT, does anyone know what module to use and
> where to get them from?
I didn't see where is said in the FAQ that
"How can I take a string and turn it into epoch seconds?"
was unix specific.
Is your date a fixed format? timelocal and localtime might get you
started.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Sun, 4 Apr 1999 15:07:21 +0100
From: "Matt" <matt@gapps.co.uk>
Subject: Get data from textbox's and store for other page [ HELP PLEASE]
Message-Id: <hmKN2.2217$04.1572@stones>
Can anyone Help?
I need to be able to get data from textbox's in a form and store that data
in varibles. Then i need to be able to retreive the data later on in a
different web page.
Is this possible without using cookies because cookies can't hold all the
amount information i need to store (I don't think any way).
I need to store this personel details about people :-
Name, House Address, Street, Town/City,County, Postcode
Telephone, E-Mail, Card Name, Card Type, Card Expirey
Card Number
I would like to do this in perl and make it secure from outsiders. These
details only need to be stored while the user is on my page.
Please Respond To
matt@gapps.co.uk
------------------------------
Date: Sun, 04 Apr 1999 15:16:41 GMT
From: dragon@dragonlord.force9.net (Gary Wilson)
Subject: Re: Get data from textbox's and store for other page [ HELP PLEASE]
Message-Id: <tnLN2.1727$54.1487@wards>
[Posted and mailed]
In article <hmKN2.2217$04.1572@stones>,
"Matt" <matt@gapps.co.uk> writes:
> Can anyone Help?
>
> I need to be able to get data from textbox's in a form and store that data
> in varibles. Then i need to be able to retreive the data later on in a
> different web page.
>
> Is this possible without using cookies because cookies can't hold all the
> amount information i need to store (I don't think any way).
>
> I need to store this personel details about people :-
>
> Name, House Address, Street, Town/City,County, Postcode
> Telephone, E-Mail, Card Name, Card Type, Card Expirey
> Card Number
>
> I would like to do this in perl and make it secure from outsiders. These
> details only need to be stored while the user is on my page.
>
> Please Respond To
>
> matt@gapps.co.uk
>
Make the cgi generate all the html. That way you pull the data
off a form, store it in variables, then you can put the data back
into a different page. The easiest way to do this is to use a
hidden 'what' field that you use to determine which part of the cgi
script is executed.
--
| Gary Wilson http://www.free-online.net/
| Network Administrator, http://www.force9.net/
| Security Master http://www.plus.net.uk/
|
| PlusNet Technologies Ltd * EMail: gwilson@plus.net.uk *
+------- Force9 & Free Online are PlusNet services ----------
------------------------------
Date: Sun, 04 Apr 1999 19:32:29 GMT
From: kskvarci@my-dejanews.com
Subject: IIS SMTP and io:socket problem
Message-Id: <7e8eoe$39v$1@nnrp1.dejanews.com>
The following script connects to Unix machines running sendamil fine, but when
trying to connect to IIS SMTP on NT, it hangs.
E.G.
Conecting to a unix host:
220 unixhost.net ESMTP Sendmail 8.9.3/8.9.3; Sun, 4 Apr 1999 19:18:15 GMT
250 unixhost.lala.net Hello DHCP004-237.lala.COM [171.78.4.237], pleased to
meet you
250 kskvarci@lala.com... Sender ok
250 kskvarci@lala.com... Recipient ok
354 Enter mail, end with "." on a line by itself
250 TAA21633 Message accepted for delivery
221 unixhost.lala.net closing connection
Connecting to NT IIS SMTP host:
Hangs at
220 ESMTP Spoken Here
The scripts is as follows:
use IO::Socket;
my($pipe) = IO::Socket::INET->new( Proto => "tcp",
PeerAddr => "cam-mail-relay1.bbnplanet.com",
PeerPort => "25",
)
or die "Can't connect: $!";
#sleep 5;
$pipe->autoflush(1);
print $pipe "HELO 127.0.0.1\n";
print $pipe "MAIL FROM:kskvarci\@bbnplanet.com\n";
print $pipe "RCPT TO:kskvarci\@bbnplanet.com\n";
print $pipe "DATA\n";
print $pipe "test\n";
print $pipe ".\n";
print $pipe "QUIT\n";
while ( <$pipe> ) { print }
#close $pipe;
Any ideas
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 4 Apr 1999 20:06:33 +0100
From: "Jonathan" <jonathan@meanwhile.freeserve.co.uk>
Subject: Lisp influences on Perl, Perl as an AI language
Message-Id: <7e8d8g$9hu$1@news4.svr.pol.co.uk>
Let me start out by saying *I am not trying to start a language war here.* I
think Perl is an incredibly beautiful language, and I have a lot of
admiration for what I know about Lisp.
I've always meant to learn Lisp - when I have the time, which is never now.
I started learning Perl last week, because I thought it would be the best
tool to write some file convertors in. This turns out to be true, but I've
been shocked at how much else the language seems good for.
The most impressive things about Perl seem to me to be [1] the flexibile
and creative way it lets you treat data structures - hashes of hashes of
arrays and such are a marvellous idea, and likewise the support the langauge
has the concept of "many" through functions like for(each), keys and slice
[2] the runtime flexibility it achieves through its "I'll do my best to do
what you say" attitude, flexible function calling, ability to execute
strings etc. I can see so many possibilities here - and this is all the sort
of stuff that I thought I'd have to learn Lisp for, or hack very shakily and
at great effort into C++. (One place I got that idea is Coplien Purple
book.)
I'd be very interested to hear discussion from people who know Lisp and Perl
on this. My feeling is that Perl looks like C, but behaves just as much in
what I'd always taken to be a Lisp-ish manner.
Second part of this question: Perl seems an obvious language to use for AI.
Is anyone doing much work in this area with Perl?
Jonathan Coupe.
------------------------------
Date: Sun, 04 Apr 1999 17:01:42 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Oracle DBD work-around
Message-Id: <37079CF4.9B98649F@home.com>
[posted & mailed]
pat mercer wrote:
>
> Yuck. I assign the hash values to the lowercase key
> names and then delete the uppercase key values. There's
> got to be a better way to do this.
Not really. That seems as good a way as any.
> If anything, is there a simple and elegant one-liner that'll
> convert hash keys from upper to lowercase?
Here's one which should do for this application.
%hash = map { lc $_ => $hash{$_} } keys %hash;
I think your method would scale up better to bigger hashes.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 4 Apr 1999 13:11:46 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Oracle DBD work-around
Message-Id: <7e870l$o2l$1@bgtnsc01.worldnet.att.net>
> For the Oracle driver, the 'fetchrow_hashref' method returns
> table column names in UPPERCASE. Is there a way to return the
> column names in lowercase?
>
> Currently, to convert the column names from UPPER to lowercase,
> I do the following ...
>
> ---
> $hash_ref = $sth->fetchrow_hashref;
>
> my ( $lc_key, $uc_key );
>
> foreach $uc_key ( keys( %$hash_ref ) )
> {
> $lc_key = lc( $uc_key );
> $hash_ref->{$lc_key} = $hash_ref->{$uc_key};
> delete $hash_ref->{$uc_key};
> }
Why can't you do something like this:
---
$hash_ref = $sth->fetchrow_hashref;
my ( $uc_key );
foreach $uc_key ( keys( %$hash_ref ) ) {
$uc_key =~ tr/A-Z/a-z/;
}
---
And there you go! Basically that says to replace all upper-case letters in
the string with lowercase ones. It is clean, simple, and works like a
champ...
Jason Simms
------------------------------
Date: Sun, 04 Apr 1999 18:07:48 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Oracle DBD work-around
Message-Id: <3707AC6F.39D405D@home.com>
[posted & mailed]
Jason Simms wrote:
>
> Why can't you do something like this:
Because it's an expensive noop?
> ---
> $hash_ref = $sth->fetchrow_hashref;
>
> my ( $uc_key );
>
> foreach $uc_key ( keys( %$hash_ref ) ) {
> $uc_key =~ tr/A-Z/a-z/;
> }
> ---
>
> And there you go! Basically that says to replace all upper-case
> letters in the string with lowercase ones.
Not quite since it won't respect the locale. That probably doesn't
matter in this case, but it's still silly to use tr to do lc's job.
I think pat wants to change the way the keys are stored, presumably so
the hash values can be accessed through lower case keys later.
Iterating through a list of keys and lower-casing them will not affect
the original hash in any way.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 4 Apr 1999 11:00:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Oracle DBD work-around
Message-Id: <MPG.11714894b55d94398982b@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
[comp.lang.perl.modules deleted.]
In article <7e870l$o2l$1@bgtnsc01.worldnet.att.net> on Sun, 4 Apr 1999
13:11:46 -0400, Jason Simms <ffchopin@worldnet.att.net >says...
...
> $hash_ref = $sth->fetchrow_hashref;
>
> my ( $uc_key );
>
> foreach $uc_key ( keys( %$hash_ref ) ) {
> $uc_key =~ tr/A-Z/a-z/;
> }
> ---
>
> And there you go! Basically that says to replace all upper-case letters in
> the string with lowercase ones. It is clean, simple, and works like a
> champ...
Does it really work for you? It doesn't for me, and I wouldn't expect
it to. Here is the documentation from perlsyn:
"If any element of LIST is an lvalue, you can modify it by modifying VAR
inside the loop. That's because the foreach loop index variable is an
implicit alias for each item in the list that you're looping over."
The members of the list of keys are rvalues (expressions whose values
are the keys), not lvalues (references to the keys).
Here is my simple test program:
#!/usr/local/bin/perl -w
use strict;
my %h = ( A => 0, B => 1 );
print keys %h;
$_ = lc, print for keys %h;
print keys %h;
__END__
It is clean and simple, and it prints 'ABabAB'. Please show the program
that works like a champ for you.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 4 Apr 1999 11:56:58 -0700
From: thirdeye@sonic.net (Peter Rowell)
Subject: Re: Perlshop
Message-Id: <7e8clq$kvp@bolt.sonic.net>
In article <7dvr25$qe7@news3.euro.net>,
Nico Oosterwijk <N.Oosterwijk@neveru.nl> wrote:
>In the perlshop.cgi file there is a line that I don't understand:
>if (lc $unique_id eq '!ORDERID!') || ( $unique_id !~ /\d{$id_length}?/ ))
> {&Transmission_error(3);}
Hmmm. What version of perlshop are you using? I have a (possibly
ancient) copy, version 3.1 dated about March 30, 1997.
The line you show reads as follows in my copy:
perlshop.cgi:486:
if (($unique_id eq '!ORDERID!') || ( $unique_id !~ /\d{$id_length}?/ ))
{&Transmission_error(3);}
Things to note:
1. The parens are balanced. (Was this a typo on your part?)
2. There is no "lc". (When was this added and by whom?)
Since the "lc" forces $unique_id to lower case, it can *never*
match a string with even one upper case character in it. Then
if the check for some string of digits fails -> Transmission_error.
HTH,
Peter
peter@thirdeye.com
------------------------------
Date: Sun, 04 Apr 1999 15:48:04 GMT
From: Kenneth Rose <kenrose@home.com>
Subject: Regular Expression Practice
Message-Id: <37078994.6AFDD21B@home.com>
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:
s/(\w+)/\u$1/sg;
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:
$_ = "1234567893424";
$_ = reverse($_);
s/(\d{3})/$1,/sgi;
$_ = reverse($_);
s/^,//s;
print $_;
I don't like the fact that I have to reverse it, then apply the regexp,
then reverse it again. Also, the 2nd regexp is to remove a potential
first comma. Anyways, the 2st regexp places a comma every 3rd digit.
But, it does this from the beginning. Is there anyway I can specify it
to start from the end (and yes, I tried putting a $ at the end, even
with a /g ending it still only did it once).
Thanks to everyone!
/<enneth Rose
Perl rocks!
------------------------------
Date: Sun, 4 Apr 1999 12:28:33 -0400
From: "Jason Simms" <ffchopin@worldnet.att.net>
Subject: Re: Regular Expression Practice
Message-Id: <7e84f4$g4u$1@bgtnsc01.worldnet.att.net>
Using the example from Programming Perl, here is hw it's done:
#!usr/bin/perl -w
$number = 123456789;
1 while $number=~ s/(\d)(\d\d\d)(?!\d)/$1,$2/;
print "$number";
#END
You basically say "Keep running this RegEx as long as I can continue putting
a comma after each series of three digits.".
Jason Simms
Kenneth Rose <kenrose@home.com> wrote in message
news:37078994.6AFDD21B@home.com...
> 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:
>
> s/(\w+)/\u$1/sg;
>
> 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:
>
> $_ = "1234567893424";
> $_ = reverse($_);
> s/(\d{3})/$1,/sgi;
> $_ = reverse($_);
> s/^,//s;
> print $_;
>
> I don't like the fact that I have to reverse it, then apply the regexp,
> then reverse it again. Also, the 2nd regexp is to remove a potential
> first comma. Anyways, the 2st regexp places a comma every 3rd digit.
> But, it does this from the beginning. Is there anyway I can specify it
> to start from the end (and yes, I tried putting a $ at the end, even
> with a /g ending it still only did it once).
>
> Thanks to everyone!
>
> /<enneth Rose
>
> Perl rocks!
------------------------------
Date: Sun, 04 Apr 1999 08:23:27 -0500
From: brian@pm.org (brian d foy)
Subject: Re: Silicon Valley Perl Mongers?
Message-Id: <brian-ya02408000R0404990823270001@news.panix.com>
In article <tSEN2.163$zE3.4447@typhoon.nycap.rr.com>, "IndexFinger.com" <indexfinger@usa.net> posted:
> Any groups in Austin, TX?
as Randal noted earlier, Perl Mongers maintains a list of
established groups. <URL:http://www.pm.org>
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: 04 Apr 1999 14:06:45 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Silicon Valley Perl Mongers?
Message-Id: <ysid81kxl16.fsf@blkbox.com>
brian@pm.org (brian d foy) writes:
> The Perl Mongers site <URL:http://www.pm.org> has all the details
> that one needs to know to get a group up and running.
Shouldn't that be www.class.org? :)
Kent
------------------------------
Date: Sun, 04 Apr 1999 21:32:35 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Split with 2 characters
Message-Id: <3707BE52.B6452FD@xs4all.nl>
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/
------------------------------
Date: Sun, 04 Apr 1999 12:08:29 -0600
From: Philip Gabbert <gp@gpcentre.net>
Subject: Re: Total beginner question (opps)
Message-Id: <040419991208292180%gp@gpcentre.net>
Opps.. I do apologize for that.. It's called UltraEdit ;-)
hehe.. I would love to email it to ya, but I'm on a Macintosh System,
and the converstion of emailing a .exe program to ya may result into a
problem or such..
but you can DL it directly from tucows at:
http://tucows.webaccess.net/htmltext95.html
Have at it ;-)
There is also tons more HTML editors there that got 5 cows as well,
choose one that best fits ya.. I use UltraEdit cause it's one of the
few that runs like Mac's BBEdit with a built in FTP, allowing me to
just alter files from the web server w/out having to Download them,
alter them and reupload them..
Philip
In article <7e715v$li$1@nnrp1.dejanews.com>, <agniora@usa.net> wrote:
> In article <030419992142357548%gp@gpcentre.net>,
> Philip Gabbert <gp@gpcentre.net> wrote:
> >
> > What's going on is that Notepad is converting the Line breaks to PC
> > line breaks..
> > I would suggest maybe UUEdit to edit your perl scripts, or you can use
> > WordPad..
> > The reson I suggested UUEdit cause it will color code your text for
> > Perl Script, and HTML, also it understands Unix Line breaks..
> > I Set all my programs for Web Development on my Mac, and PC to default
> > to Unix line breaks..
> >
> > Have fun.. ;-)
> >
> > PS: you can find HTML editors at: http://www.tucows.com/
> Philip,
> I checked the tucow site, and i searched for UUEdit there, but it cant seem to
> find it. Do u think u can email me a copy of it.
> Thanks.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
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 5295
**************************************