[23080] in Perl-Users-Digest
Perl-Users Digest, Issue: 5301 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 31 18:10:39 2003
Date: Thu, 31 Jul 2003 15:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 31 Jul 2003 Volume: 10 Number: 5301
Today's topics:
Substitution Question <mikeflan@earthlink.net>
Re: Substitution Question <noreply@gunnar.cc>
Re: Substitution Question <biff_the_gorilla_killa@blueyonder.co.uk>
Re: Substitution Question <noreply@gunnar.cc>
Term::ANSIColor How can I print the color directly to <hasting@agere.com>
Time compare using milliseconds (Paulers)
Re: Time compare using milliseconds (Tad McClellan)
Re: Web development and Perl 6 <cwilbur@mithril.chromatico.net>
Re: Web development and Perl 6 <noreply@gunnar.cc>
Re: Web page with frames... <flavell@mail.cern.ch>
Re: Why, oh why have I read "Perl 6 essentials"??? <jaspax@u.washington.edu>
Wide character in print <shtil@comcast.net>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 31 Jul 2003 21:15:39 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Substitution Question
Message-Id: <3F298788.165DBF9E@earthlink.net>
I simply want to convert Adkins to Adki01
This code is close, but has a space between
Adki and 01
$temp =~ s/^(.{0,4})..$/$1 01/;
If I take out the space, it gives an error:
Use of uninitialized value in substitution interator" . . .
I tried parens and a few other things, but none worked.
I check the faqs and other documentation, but did
not find the answer. Can anybody help?
Mike
------------------------------
Date: Thu, 31 Jul 2003 23:33:25 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Substitution Question
Message-Id: <bgc276$n90cq$1@ID-184292.news.uni-berlin.de>
Mike Flannigan wrote:
> I simply want to convert Adkins to Adki01
>
> This code is close, but has a space between
> Adki and 01
>
> $temp =~ s/^(.{0,4})..$/$1 01/;
>
> If I take out the space, it gives an error:
> Use of uninitialized value in substitution interator" . . .
This may do what you want:
$temp =~ s/^(.{0,4})..$/$1.'01'/e;
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 31 Jul 2003 22:42:17 +0100
From: "biff_the_gorilla_killa" <biff_the_gorilla_killa@blueyonder.co.uk>
Subject: Re: Substitution Question
Message-Id: <L2gWa.201$7q1.50@news-binary.blueyonder.co.uk>
$temp =~s/^(.{0,4})..$/${1}01/;
Cheers
Biff.
"Mike Flannigan" <mikeflan@earthlink.net> wrote in message
news:3F298788.165DBF9E@earthlink.net...
>
> I simply want to convert Adkins to Adki01
>
> This code is close, but has a space between
> Adki and 01
>
> $temp =~ s/^(.{0,4})..$/$1 01/;
>
> If I take out the space, it gives an error:
> Use of uninitialized value in substitution interator" . . .
>
> I tried parens and a few other things, but none worked.
>
> I check the faqs and other documentation, but did
> not find the answer. Can anybody help?
>
>
> Mike
>
>
------------------------------
Date: Thu, 31 Jul 2003 23:56:55 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Substitution Question
Message-Id: <bgc3j9$negn5$2@ID-184292.news.uni-berlin.de>
biff_the_gorilla_killa wrote:
> $temp =~s/^(.{0,4})..$/${1}01/;
Yes, of course. I hereby withdraw my suggestion (even if that works,
also). ;-)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 31 Jul 2003 17:58:50 -0400
From: "Joe Hasting" <hasting@agere.com>
Subject: Term::ANSIColor How can I print the color directly to a printer
Message-Id: <bgc3eq$h9$1@alageremail2.agere.com>
I have been using Term::ANSIColor to have printed charaters on my screen,
how can I direct the ANSI escaped code to a color printer directly and have
it print in color (not print the ANSI escape codes). I tried the simple
code below. The first page comes out ok, but the second page is printed
with the escape codes. Thanks J
--------------
31;40mtest
0m32;41mtest
0m
----------------
use Term::ANSIColor;
open(LPR, "|lpr -P agrprt166 >/dev/null 2>&1");
print LPR "test\n";
print LPR "test\n";
close(LPR);
open(LPR, "|lpr -P agrprt166 >/dev/null 2>&1");
print LPR colored ("test\n", "red on_black");
print LPR colored ("test\n", "green on_red");
close(LPR);
------------------------------
Date: 31 Jul 2003 12:26:33 -0700
From: paulers@cox.net (Paulers)
Subject: Time compare using milliseconds
Message-Id: <78f80819.0307311126.7fb9b417@posting.google.com>
Hello all,
I have two timestamps that look like this:
08:42:38:624
08:42:39:437
I need to find out the difference. I have never worked with
milliseconds before so I was wondering if you could point me in the
right direction.
------------------------------
Date: Thu, 31 Jul 2003 15:44:44 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Time compare using milliseconds
Message-Id: <slrnbiivts.1pn.tadmc@magna.augustmail.com>
Paulers <paulers@cox.net> wrote:
> I have two timestamps that look like this:
>
> 08:42:38:624
> 08:42:39:437
>
> I need to find out the difference. I have never worked with
> milliseconds before so I was wondering if you could point me in the
> right direction.
Huh? Your cause and effect are completely disjoint.
Milliseconds are just like seconds, only there are 1000 of them.
Either:
instead of integer seconds, use floating point seconds: 38.624 seconds.
or, better:
convert everything to (integer) milliseconds, and then just subtract.
--------------------------------
#!/usr/bin/perl
use strict;
use warnings;
foreach ( qw/ 08:42:38:624 08:42:39:437/ ) {
my $millis = to_millis($_);
print "$_ is $millis milliseconds\n";
}
sub to_millis {
my( $hours, $minutes, $seconds, $millis) = split /:/, $_[0];
$millis += 1000 * $seconds;
$millis += 1000 * 60 * $minutes;
$millis += 1000 * 60 * 60 * $hours;
return $millis;
}
--------------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 31 Jul 2003 21:26:03 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Web development and Perl 6
Message-Id: <87vftitmja.fsf@mithril.chromatico.net>
Garry Heaton <none@none.com> writes:
> The future design of Perl may not be but it usage amongst new web
> developers may well be. There is currently a truckload of PHP/MySQL
> web development books available. I can only think of one, Paul
> Dubois, for Perl and MySQL. You have to ask why this is, or don't
> you care?
As for myself, I don't much care if new web developers who want toy
scripts use Perl or not. Perl has a *far* superior set of tools for
the difficult web tasks; if PHP gets the easy ones, no skin off my
nose, because the difficult ones are more interesting.
Beyond that, MySQL is bone-simple. Even assuming that it weren't,
though, I don't need 30 good books on a topic, I need *one* good book
on a topic. The truckload of PHP/MySQL books currently exists for one
reason: publishers are fairly certain they can sell them.
> Fine, but don't forget that Perl's popularity boom in the mid-90s was
> largely due to the lack of competition in the web scripting sphere.
Lack of competition? I beg to differ, on two counts.
First, in the mid-90s, there were several contenders for server-side
scripting. I myself have used Tcl, C, and Scheme, as well as Perl and
server-side Java, for that purpose. From what I understand Python was
an early contender as well.
Second, Perl was well-established before the popularity boom, and was
already solidly in place as a system administration and glue language.
The reason Perl made such great inroads is that Perl has a rich set of
string manipulation tools available. So long as Perl continues to
have a rich set of tools available, it will continue to be useful. If
it becomes less relevant to clueless web newbies, so much the better.
> New web developers are turning to PHP. I wish it were otherwise as I
> love using Perl. However, mod_perl hosts are very thin on the
> ground. If new students can get free PHP/MySQL hosting to learn web
> development they're going to choose that over the complexity and
> relative unavailability of mod_perl.
Let them!
It does me more benefit if the novice web users all use PHP and MySQL,
because *I* know Perl. So when someone needs a job done that's too
big for PHP and MySQL, they'll turn to Perl and Postgres or Oracle.
Benefit for me: the easy, boring stuff is being handled by eager PHP
kiddies. Benefit for me: few people know how to handle the hard,
interesting stuff. How is this a bad thing?
Charlton
------------------------------
Date: Thu, 31 Jul 2003 23:52:41 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Web development and Perl 6
Message-Id: <bgc3bc$negn5$1@ID-184292.news.uni-berlin.de>
Charlton Wilbur wrote:
> The reason Perl made such great inroads is that Perl has a rich set
> of string manipulation tools available. So long as Perl continues
> to have a rich set of tools available, it will continue to be
> useful. If it becomes less relevant to clueless web newbies, so
> much the better.
Err.. I suppose that you started your programming career as a clueless
newbie, too. Didn't we all? (Some would say that I'm still there, btw.)
>> New web developers are turning to PHP. I wish it were otherwise
>> as I love using Perl. However, mod_perl hosts are very thin on
>> the ground. If new students can get free PHP/MySQL hosting to
>> learn web development they're going to choose that over the
>> complexity and relative unavailability of mod_perl.
>
> Let them!
>
> It does me more benefit if the novice web users all use PHP and
> MySQL, because *I* know Perl. So when someone needs a job done
> that's too big for PHP and MySQL, they'll turn to Perl and Postgres
> or Oracle. Benefit for me: the easy, boring stuff is being handled
> by eager PHP kiddies. Benefit for me: few people know how to
> handle the hard, interesting stuff. How is this a bad thing?
Benefit for you? Maybe. Benefit for Perl? Personally I'm not convinced.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 31 Jul 2003 20:04:19 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Web page with frames...
Message-Id: <Pine.LNX.4.53.0307311950190.670@lxplus009.cern.ch>
On Thu, Jul 31, Dave Brown inscribed on the eternal scroll:
> Caught by the topic police.
If you, like me, need lots of fresh coffee for programming, it would
be natural to ask one's Perl questions on rec.food.drink.coffee,
right?
> (It has to do with CGI programming which I happen to be doing in
> perl.)
Did you get the point yet?
> Perhaps you could recommend a relevant newsgroup for CGI
> programming?
If it's a question _about_ CGI programming, then naturally, just as it
says in perlfaq9 - comp.infosystems.www.authoring.cgi, (read its
posting instructions first - beware of the autobot...)
But if it's a problem with the HTML that you're trying to generate
from your CGI process, then they're likely to send you off for a basic
course in HTML before they'd be happy to let you loose on server-side
scripting.
> BTW, the target tag worked, though I couldn't find it in my old
> O'Reilly HTML book.
You really need to find the authoritative specifications for the
various technologies involved in what you're doing. No point in
writing a program to do some task until you've understood basically
what that task is (to be frank.)
good luck
--
"This is not rocket surgery" - Stan Brown
------------------------------
Date: Thu, 31 Jul 2003 12:39:12 -0700
From: JS Bangs <jaspax@u.washington.edu>
Subject: Re: Why, oh why have I read "Perl 6 essentials"???
Message-Id: <Pine.A41.4.56.0307311238250.110694@dante36.u.washington.edu>
Simon sikyal:
> This book is evil, especially the part about junctions. I am *dying* to use them!!!
> :((((
:). I haven't read the book, but the Apocalypses make my mouth water . . .
especially the new subroutine declaration syntax. Soon, they say.
--
Jesse S. Bangs jaspax@u.washington.edu
http://students.washington.edu/jaspax/
http://students.washington.edu/jaspax/blog
Jesus asked them, "Who do you say that I am?"
And they answered, "You are the eschatological manifestation of the ground
of our being, the kerygma in which we find the ultimate meaning of our
interpersonal relationship."
And Jesus said, "What?"
------------------------------
Date: Thu, 31 Jul 2003 19:25:58 GMT
From: "Yuri Shtil" <shtil@comcast.net>
Subject: Wide character in print
Message-Id: <a3eWa.21387$cF.8823@rwcrnsc53>
Hi all
I am getting this when I try to print certain strings. Is it harmless ?
If not, how do I get rid of it ?
Yuri.
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
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.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.
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 V10 Issue 5301
***************************************