[16411] in Perl-Users-Digest
Perl-Users Digest, Issue: 3823 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 27 18:06:43 2000
Date: Thu, 27 Jul 2000 15:05:29 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964735528-v9-i3823@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 27 Jul 2000 Volume: 9 Number: 3823
Today's topics:
401 header with Perl lpetre@my-deja.com
Re: Advanced Perl Programming -- Dated? <bart.lateur@skynet.be>
Re: Bowling for strings (was: shifting strings ) <lauren_smith13@hotmail.com>
Can a FILEHANDLE be a HASH zephar@my-deja.com
Re: Can a FILEHANDLE be a HASH <aqumsieh@hyperchip.com>
Can't find IO::Pager <kfh@mqsoftware.com>
Re: CGI-Perl question - Form results writing to a file <lr@hpl.hp.com>
database alternative <Seb.Erlhofer@evc.net>
database alternative <Seb.Erlhofer@evc.net>
database alternative <Seb.Erlhofer@evc.net>
Re: database alternative (Abigail)
Re: database alternative (Abigail)
Re: database alternative <lauren_smith13@hotmail.com>
Re: database alternative (Abigail)
Re: DBI.pm CGI.pm tutorial needed <lr@hpl.hp.com>
Re: Delete records in 2 weeks time trwww@my-deja.com
Re: difference between two times in seconds (Logan Shaw)
Re: difference between two times in seconds (Logan Shaw)
Re: difference between two times in seconds (Abigail)
Re: difference between two times in seconds (Abigail)
Re: difference between two times in seconds (Logan Shaw)
Re: difference between two times in seconds (Abigail)
Re: Do I Need Chomp? <was Critiques, please> (BUCK NAKED1)
download file from another server <Seb.Erlhofer@evc.net>
download file from another server <Seb.Erlhofer@evc.net>
Re: download file from another server (Abigail)
Re: download file from another server (Abigail)
Re: Expanding lists of ranges of integers 1-3,5-8,9,13- (Abigail)
flatfile storage <Seb.Erlhofer@evc.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 27 Jul 2000 18:11:27 GMT
From: lpetre@my-deja.com
Subject: 401 header with Perl
Message-Id: <8lpu0a$tlk$1@nnrp1.deja.com>
I'm using Perl 5.6.0 and I'm trying to make a page that prints a 401
header, so the browser prompts for a username and password, then I want
my script to validate that information.
I print the correct headers, and the browser asks for the username and
password, but after that I don't know where in my code, or how exactly
to validate the user's input. My script seems to
keep printing the 401 header over and over again.
I'm using the iPlanet 4.1sp1 webserver and Solaris 8.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 27 Jul 2000 19:01:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Advanced Perl Programming -- Dated?
Message-Id: <dj11os8jq6n2o7aevdpkq432t4tvlmaid0@4ax.com>
Marcel Grunauer wrote:
>And $foo is a reference to @foo, %foo, sub foo or which one?
>
>Or is that $$foo? or $@foo? What then becomes of @@foo?
As with Highlander: "There Can Be Only One". If you have a sub foo, yopu
can no longer use any variable $foo, @foo or %foo. As is the case with
many languages.
>Can of worms.
Well, yes. But the situation as it is now is pretty confusing for
programmers coming from other languages.
--
Bart.
------------------------------
Date: Thu, 27 Jul 2000 12:42:31 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Bowling for strings (was: shifting strings )
Message-Id: <8lq399$ia2$1@brokaw.wa.com>
Lauren Smith <lauren_smith13@hotmail.com> wrote in message
news:8lptkv$eim$1@brokaw.wa.com...
>
> $str1 = "abcd";
> chop ($str2 = join ('', split //, $str1));
This one follows along the same lines.
$str1 = 'abcd';
$str2 = reverse join '', (map chop, split //, reverse $str1)[1..length
$str1];
I don't know why it gives me an uninitialized value warning, though.
Lauren
------------------------------
Date: Thu, 27 Jul 2000 18:03:49 GMT
From: zephar@my-deja.com
Subject: Can a FILEHANDLE be a HASH
Message-Id: <8lpti2$te4$1@nnrp1.deja.com>
I know a FILEHANDLE can be scalar but for
some reason it seems a it cannoit be a HASH
can anyone tell me how to run this as a hash?
Running under solaris 2.6
# this looks good
$x = "fh";
open($x, ">./x") || die "Could not open file [./x]], error [$!]\n";
print($x "Message one") || die "Could not write , error [$!]\n";
close ($x);
# this doesnt work
$y = "key";
#$x{$y} = "fh";
open($x{$y}, ">./2x") || die "Could not open file [./x]], error [$!]\n";
print '$x{$y}' "Message two" || die "Could not write , error
[$!]\n";
close($x{$y});
# this works again
$y = "key";
$x{$y} = "";
open($x{$y}, ">./3x") || die "Could not open file [./x]], error [$!]\n";
$f = $x{$y};
print($f "Message three") || die "Could not write , error [$!]\n";
close($x{$y});
Errors are
String found where operator expected at ip.pl line 14, near "'$x{$y}'
"Message two"
(Missing operator before "Message two"?)
syntax error at ip.pl line 14, near "'$x{$y}' "Message two""
Execution of ip.pl aborted due to compilation errors.
Can anyone shed some light???
Thanks
Jim
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 27 Jul 2000 18:23:02 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Can a FILEHANDLE be a HASH
Message-Id: <7a3dkvh1pz.fsf@merlin.hyperchip.com>
zephar@my-deja.com writes:
> I know a FILEHANDLE can be scalar but for
> some reason it seems a it cannoit be a HASH
> can anyone tell me how to run this as a hash?
It can not be a hash. You can store a filehandle in a scalar,
though. But hash values ARE scalars, so you can store filehandles in
hashes.
> # this doesnt work
> $y = "key";
> #$x{$y} = "fh";
uncomment this out ..
> open($x{$y}, ">./2x") || die "Could not open file [./x]], error [$!]\n";
> print '$x{$y}' "Message two" || die "Could not write , error
print {$x{$y}} "Message two" or die "Could not write $!\n";
> [$!]\n";
> close($x{$y});
--Ala
------------------------------
Date: Thu, 27 Jul 2000 12:24:48 -0500
From: Kelly F. Hickel <kfh@mqsoftware.com>
Subject: Can't find IO::Pager
Message-Id: <70s0os8ll0rug8msoe4jijgs8irv4l2dn6@4ax.com>
I'm using the packager Getopt::Declare, and it says that if the module
IO::Pager is present, it will use that to page output to STDOUT. The
problem is that I can't seem to find IO::Pager on CPAN.
Does anyone know where to get IO::Pager, or what I'm doing wrong?
Thanks,
Kelly Hickel
------------------------------
Date: Thu, 27 Jul 2000 13:05:58 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: CGI-Perl question - Form results writing to a file
Message-Id: <MPG.13ea35fce7d3f0198abf7@nntp.hpl.hp.com>
In article <39805769.12841699@209.247.210.101> on Thu, 27 Jul 2000
15:40:50 GMT, Liam <lkenny@fisheries.org> says...
...
> open (EM, ">>cgi-local/email.txt") or dienice("Can't open email list:
> $!");
This is a relative path. You have no assurance what the current
directory is when the CGI program starts. Use an absolute path, or set
the current directory explicitly.
...
<Jeopardectomy of entire post being responded to.>
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 27 Jul 2000 20:19:26 +0200
From: Sebastian Erlhofer <Seb.Erlhofer@evc.net>
Subject: database alternative
Message-Id: <45v0osc5vtq7p7e723g4apdfsdvaonva44@4ax.com>
Hi
My server is hosted. I don't have Telnet access or anything like that.
So I cannot create a database (mySQL etc) :(
Is there a possibility to create a database in my subdirectory without
prompt?
What alternatives do I have instead of the SQL which needs to create a
database file first? Flatfile is not the final solution...
Tnx
Sebastian
------------------------------
Date: Thu, 27 Jul 2000 20:54:06 +0200
From: Sebastian Erlhofer <Seb.Erlhofer@evc.net>
Subject: database alternative
Message-Id: <b911os89gltplkvsqaa565t92qbroevgi5@4ax.com>
On 27 Jul 2000 14:37:45 EDT, abigail@foad.org (Abigail) wrote:
>Sebastian Erlhofer (Seb.Erlhofer@evc.net) wrote on MMDXXII September
>MCMXCIII in <URL:news:45v0osc5vtq7p7e723g4apdfsdvaonva44@4ax.com>:
>^^ Hi
>^^
>^^ My server is hosted. I don't have Telnet access or anything like that.
>^^ So I cannot create a database (mySQL etc) :(
>^^
>^^ Is there a possibility to create a database in my subdirectory without
>^^ prompt?
>^^ What alternatives do I have instead of the SQL which needs to create a
>^^ database file first? Flatfile is not the final solution...
>
>
>And your Perl question is?
Is: What alternatives gives me perl except flatfile-format! :)
Seb
------------------------------
Date: Thu, 27 Jul 2000 22:23:00 +0200
From: Sebastian Erlhofer <Seb.Erlhofer@evc.net>
Subject: database alternative
Message-Id: <df61oss20jc6d65qqcnr1vnjdikq4td37i@4ax.com>
>?? >And your Perl question is?
>??
>?? Is: What alternatives gives me perl except flatfile-format! :)
>
>
>About any database you can imagine. But that doesn't solve your problem,
>now does it?
>
>
>Abigail
Well, as I said... I cannot create a database with prompt command...
and my question, dear ABIGAIL, was: how can I OR what alternatives are
there...
Seb
------------------------------
Date: 27 Jul 2000 14:37:45 EDT
From: abigail@foad.org (Abigail)
Subject: Re: database alternative
Message-Id: <slrn8o10bg.vcg.abigail@alexandra.foad.org>
Sebastian Erlhofer (Seb.Erlhofer@evc.net) wrote on MMDXXII September
MCMXCIII in <URL:news:45v0osc5vtq7p7e723g4apdfsdvaonva44@4ax.com>:
^^ Hi
^^
^^ My server is hosted. I don't have Telnet access or anything like that.
^^ So I cannot create a database (mySQL etc) :(
^^
^^ Is there a possibility to create a database in my subdirectory without
^^ prompt?
^^ What alternatives do I have instead of the SQL which needs to create a
^^ database file first? Flatfile is not the final solution...
And your Perl question is?
(I guess you should be talking to your system administrator. Or to some
script kiddies that can help you break in)
Abigail
--
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-
------------------------------
Date: 27 Jul 2000 15:31:22 EDT
From: abigail@foad.org (Abigail)
Subject: Re: database alternative
Message-Id: <slrn8o13g1.vcg.abigail@alexandra.foad.org>
Sebastian Erlhofer (Seb.Erlhofer@evc.net) wrote on MMDXXII September
MCMXCIII in <URL:news:b911os89gltplkvsqaa565t92qbroevgi5@4ax.com>:
?? On 27 Jul 2000 14:37:45 EDT, abigail@foad.org (Abigail) wrote:
??
?? >Sebastian Erlhofer (Seb.Erlhofer@evc.net) wrote on MMDXXII September
?? >MCMXCIII in <URL:news:45v0osc5vtq7p7e723g4apdfsdvaonva44@4ax.com>:
?? >^^ Hi
?? >^^
?? >^^ My server is hosted. I don't have Telnet access or anything like that.
?? >^^ So I cannot create a database (mySQL etc) :(
?? >^^
?? >^^ Is there a possibility to create a database in my subdirectory without
?? >^^ prompt?
?? >^^ What alternatives do I have instead of the SQL which needs to create a
?? >^^ database file first? Flatfile is not the final solution...
?? >
?? >
?? >And your Perl question is?
??
?? Is: What alternatives gives me perl except flatfile-format! :)
About any database you can imagine. But that doesn't solve your problem,
now does it?
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
------------------------------
Date: Thu, 27 Jul 2000 13:43:24 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: database alternative
Message-Id: <8lq6re$jsn$1@brokaw.wa.com>
Sebastian Erlhofer <Seb.Erlhofer@evc.net> wrote in message
news:df61oss20jc6d65qqcnr1vnjdikq4td37i@4ax.com...
>
> >?? Is: What alternatives gives me perl except flatfile-format! :)
> >
> >
> >About any database you can imagine. But that doesn't solve your problem,
> >now does it?
> >
> >Abigail
>
> Well, as I said... I cannot create a database with prompt command...
> and my question, dear ABIGAIL, was: how can I OR what alternatives are
> there...
Have you seen tie() or MLDBM.pm? (Or am I confusing plain-text with
flatfile?)
Lauren
------------------------------
Date: 27 Jul 2000 17:55:11 EDT
From: abigail@foad.org (Abigail)
Subject: Re: database alternative
Message-Id: <slrn8o1btn.vcg.abigail@alexandra.foad.org>
Sebastian Erlhofer (Seb.Erlhofer@evc.net) wrote on MMDXXII September
MCMXCIII in <URL:news:df61oss20jc6d65qqcnr1vnjdikq4td37i@4ax.com>:
??
?? >?? >And your Perl question is?
?? >??
?? >?? Is: What alternatives gives me perl except flatfile-format! :)
?? >
?? >
?? >About any database you can imagine. But that doesn't solve your problem,
?? >now does it?
?? >
?? >
?? >Abigail
??
?? Well, as I said... I cannot create a database with prompt command...
?? and my question, dear ABIGAIL, was: how can I OR what alternatives are
?? there...
Well, as I said, what is your *Perl* question?
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
------------------------------
Date: Thu, 27 Jul 2000 13:34:19 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: DBI.pm CGI.pm tutorial needed
Message-Id: <MPG.13ea3ca34845136398abf8@nntp.hpl.hp.com>
In article <0c3132db.8ab378f2@usw-ex0102-014.remarq.com> on Thu, 27 Jul
2000 09:46:04 -0700, RS@ <rschram@reed.edu> <RS@ <rschram@reed.edu>>
says...
> A good CGI book that spends some time discussing DBI is
> "CGI Programming with Perl" (formerly "CGI Programming on the
> World Wide Web" orig. pub in '96) O'Reilly, 2000.
>
> As for "examples" of how to use them together, no such book
> exists to my knowledge. This surprises me since database
> programming and web site programming are so closely related.
In the not-so-good book 'MySQL and mSQL', chapter 10 'Perl' has *only*
CGI examples. I thought this was one of the strikes against it.
The much-better book 'MySQL' by Widenius has a section 'Using DBI in Web
Applications' (fewer than 20 pages out of more than 750 -- but that
seems about right to me. :-).
> The
> new CGI book is good because it acknowledges that most people
> will want to program for the web in concert with DBI,
Oh???
> as well as
> other modules for playing with data, and pitches its discussion
> in that direction (unlike, for example, many examples from the
> 1996 1st edition, which revolved largely around how to make a
> guestbook.
>
> You'll need a reference for the DBI stuff, even after having
> mastered how to make CGI-ready output with some DBI. The two-
> book answer is not necessarily a bad one.
Agreed.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 27 Jul 2000 18:54:54 GMT
From: trwww@my-deja.com
Subject: Re: Delete records in 2 weeks time
Message-Id: <8lq0hr$vu3$1@nnrp1.deja.com>
In article <0ec4c663.445c56a8@usw-ex0108-
061.remarq.com>,
Taurean
<jaurangNOjaSPAM@crosswinds.net.invalid> wrote:
> Abigail, my record looks like this:
>
> <p align=center><font size="1">Reference:
> 964062454<br>.....
>
> I need to extract the reference number
9xxxxxxxx and then
> compare with the time(). Reference no was also
obtained
> from time() at the time of posting. In the
following code,
> if the difference is greater than 3 days, the
record will
> be deleted. I first use the
separator "Reference: " and
> then separate again using "<BR>". Then I get
the ref no
> from the left-hand side. If the condition is
true, the
> first record is deleted. The loop is then
repeated. I
> believe the code is inefficient. Care to
correct it? TIA.
I would do something like this:
open(INFILE, 'database.txt')
open(OUTFILE, '>temp.txt')
while (<INFILE>) {
(parse the record)
next if ((time() - $records_seconds) >
$three_days_worth_of_seconds);
print OUTFILE;
close(INFILE);
close(OUTFILE);
rename('temp.txt', 'database.txt');
just dont forget to flock your files and check
the return values of your opens and closes.
I think there is a problem here though... I think
that the renaing of the file starts a race
condition. Am I correct group?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 27 Jul 2000 14:35:32 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: difference between two times in seconds
Message-Id: <8lq2u4$pht$1@provolone.cs.utexas.edu>
In article <slrn8nvre5.61h.bernard.el-hagin@gdndev25.lido-tech>,
Bernard El-Hagin <bernard.el-hagin@lido-tech.net> wrote:
>>As long as we're coming up with regular expression challenges, I want
>>to see somebody write a regular expression to find the prime
>>factorization of an number.
>
>From the Perl Cookbook:
>
>#!/usr/bin/perl
># prime_pattern -- find prime factors of argument using pattern matching
>for ($N = ('o' x shift); $N =~ /^(oo+?)\1+$/; $N =~ s/$1/o/g) {
> print length($1), " ";
>}
>print length ($N), "\n";
O.K., a regular expression is *involved* in that computation, but it
doesn't *do* the computation. I might as well just convert this
$i = 100;
while ($i--)
{
# insert some code here
}
into this
$i = 100;
while ($i-- !~ /^0$/)
{
# insert some code here
}
and claim I'm doing some task with a regular expression. It does
involve a regular expression, but there are other parts that are doing
work too.
In other words, you can't "solve any problem with a regular expression"
if for some problems you find yourself leaning heavily on constructs
outside of the realm of regular expressions. It's like saying, "Oh
yeah, I can do that really complicated matrix calculation in C++", but
when you look under the hood, you find that you've actually linked with
some code written in Fortran, and the Fortran does the work.
That's not to say that these ways of finding prime factorizations
aren't clever. They are clever, I'm sure. I was just trying to think
about something more along the lines of whether they can do all tasks
that a regular language can do.
- Logan
------------------------------
Date: 27 Jul 2000 14:36:38 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: difference between two times in seconds
Message-Id: <8lq306$pio$1@provolone.cs.utexas.edu>
In article <slrn8nvo7p.vcg.abigail@alexandra.foad.org>,
Abigail <abigail@foad.org> wrote:
>Logan Shaw (logan@cs.utexas.edu) wrote on MMDXXII September MCMXCIII in
><URL:news:8lol1q$o58$1@provolone.cs.utexas.edu>:
>** In article <x74s5c6qh6.fsf@home.sysarch.com>,
>** Uri Guttman <uri@sysarch.com> wrote:
>** >>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:
>** >
>** > LS> Is $_[0] secretly some kind of reference into the caller's
>** > LS> argument list or something? And why does setting @_ to
>** > LS> itself clear this status?
>** >
>** >read perlsub. @_ is aliased to the args passed to a sub. assigning @_
>** >does a copy of the real values. reusing @_ for the copy is just subterfuge
>**
>** O.K., but I'm still curious why it works in 10 out of the 11 cases. It
>** seems like in 9 out of the 10 cases where it does work, it's modifying
>** both values anyway. So why does it suddenly break only when $_[0] hits
>** zero?
>
>Because in the first 10 cases, you modify @_. Only in the last
>case @_ remains unmodified.
So you're saying I get the "can't modify" error on in the case when I'm
not modifying something? I'm still not getting it, but maybe that's
just me.
- Logan
------------------------------
Date: 27 Jul 2000 16:22:13 EDT
From: abigail@foad.org (Abigail)
Subject: Re: difference between two times in seconds
Message-Id: <slrn8o16fc.vcg.abigail@alexandra.foad.org>
Logan Shaw (logan@cs.utexas.edu) wrote on MMDXXII September MCMXCIII in
<URL:news:8lq306$pio$1@provolone.cs.utexas.edu>:
,, In article <slrn8nvo7p.vcg.abigail@alexandra.foad.org>,
,, Abigail <abigail@foad.org> wrote:
,, >Logan Shaw (logan@cs.utexas.edu) wrote on MMDXXII September MCMXCIII in
,, ><URL:news:8lol1q$o58$1@provolone.cs.utexas.edu>:
,, >** In article <x74s5c6qh6.fsf@home.sysarch.com>,
,, >** Uri Guttman <uri@sysarch.com> wrote:
,, >** >>>>>> "LS" == Logan Shaw <logan@cs.utexas.edu> writes:
,, >** >
,, >** > LS> Is $_[0] secretly some kind of reference into the caller's
,, >** > LS> argument list or something? And why does setting @_ to
,, >** > LS> itself clear this status?
,, >** >
,, >** >read perlsub. @_ is aliased to the args passed to a sub. assigning @_
,, >** >does a copy of the real values. reusing @_ for the copy is just subterfuge
,, >**
,, >** O.K., but I'm still curious why it works in 10 out of the 11 cases. It
,, >** seems like in 9 out of the 10 cases where it does work, it's modifying
,, >** both values anyway. So why does it suddenly break only when $_[0] hits
,, >** zero?
,, >
,, >Because in the first 10 cases, you modify @_. Only in the last
,, >case @_ remains unmodified.
,,
,, So you're saying I get the "can't modify" error on in the case when I'm
,, not modifying something? I'm still not getting it, but maybe that's
,, just me.
I said you didn't modify @_. Hence, all the elements of @_ are still
aliases. Hence, one of them is a constant. Hence you cannot modify *THAT*.
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: 27 Jul 2000 16:24:14 EDT
From: abigail@foad.org (Abigail)
Subject: Re: difference between two times in seconds
Message-Id: <slrn8o16j4.vcg.abigail@alexandra.foad.org>
Logan Shaw (logan@cs.utexas.edu) wrote on MMDXXII September MCMXCIII in
<URL:news:8lq2u4$pht$1@provolone.cs.utexas.edu>:
!! In article <slrn8nvre5.61h.bernard.el-hagin@gdndev25.lido-tech>,
!! Bernard El-Hagin <bernard.el-hagin@lido-tech.net> wrote:
!! >>As long as we're coming up with regular expression challenges, I want
!! >>to see somebody write a regular expression to find the prime
!! >>factorization of an number.
!! >
!! >From the Perl Cookbook:
!! >
!! >#!/usr/bin/perl
!! ># prime_pattern -- find prime factors of argument using pattern matching
!! >for ($N = ('o' x shift); $N =~ /^(oo+?)\1+$/; $N =~ s/$1/o/g) {
!! > print length($1), " ";
!! >}
!! >print length ($N), "\n";
!!
!! O.K., a regular expression is *involved* in that computation, but it
!! doesn't *do* the computation. I might as well just convert this
Then what *does* do the computation? 'length' here doesn't do any
computation regarding to the prime factors; it only does base translation
(from base 1 to base 10).
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
------------------------------
Date: 27 Jul 2000 16:14:09 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: difference between two times in seconds
Message-Id: <8lq8n1$pso$1@provolone.cs.utexas.edu>
In article <slrn8o16j4.vcg.abigail@alexandra.foad.org>,
Abigail <abigail@foad.org> wrote:
>Logan Shaw (logan@cs.utexas.edu) wrote on MMDXXII September MCMXCIII in
>!! O.K., a regular expression is *involved* in that computation, but it
>!! doesn't *do* the computation. I might as well just convert this
>
>Then what *does* do the computation? 'length' here doesn't do any
>computation regarding to the prime factors; it only does base translation
>(from base 1 to base 10).
The "for" loop does a loop with a condition, which I'd say is a very
important part of the computation.
- Logan
------------------------------
Date: 27 Jul 2000 17:57:27 EDT
From: abigail@foad.org (Abigail)
Subject: Re: difference between two times in seconds
Message-Id: <slrn8o1c1u.vcg.abigail@alexandra.foad.org>
Logan Shaw (logan@cs.utexas.edu) wrote on MMDXXII September MCMXCIII in
<URL:news:8lq8n1$pso$1@provolone.cs.utexas.edu>:
'' In article <slrn8o16j4.vcg.abigail@alexandra.foad.org>,
'' Abigail <abigail@foad.org> wrote:
'' >Logan Shaw (logan@cs.utexas.edu) wrote on MMDXXII September MCMXCIII in
'' >!! O.K., a regular expression is *involved* in that computation, but it
'' >!! doesn't *do* the computation. I might as well just convert this
'' >
'' >Then what *does* do the computation? 'length' here doesn't do any
'' >computation regarding to the prime factors; it only does base translation
'' >(from base 1 to base 10).
''
'' The "for" loop does a loop with a condition, which I'd say is a very
'' important part of the computation.
So... what does the "for" compute?
But I see your point. Nothing can be calculated with a regex alone.
After all, you'd need Perl, an OS, hardware, electricity and fingers.
Abigail
--
sub A::TIESCALAR{bless\my$x=>A};package B;@q[0..3]=qw/Hacker Perl
Another Just/;use overload'""'=>sub{pop @q};sub A::FETCH{bless\my
$y=>B}; tie my $shoe => qq 'A';print "$shoe $shoe $shoe $shoe\n";
------------------------------
Date: Thu, 27 Jul 2000 15:46:21 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Do I Need Chomp? <was Critiques, please>
Message-Id: <29808-39809F9D-54@storefull-247.iap.bryant.webtv.net>
Thanks for the info Decklin and Bart. Now, I'm confused. Decklin says
chomp is not needed and Bart says that it is. Who is correct? or is this
a matter of taste or opinion... similar to those who contested Abigail's
order of using print before truncate?
Regards,
Dennis
------------------------------
Date: Thu, 27 Jul 2000 21:37:35 +0200
From: Sebastian Erlhofer <Seb.Erlhofer@evc.net>
Subject: download file from another server
Message-Id: <mp31os4dv3t9frpg126vlrk4n6j1lk1u9v@4ax.com>
Hi!
I want to download a ZIP file from another server to mirror it.
The script will be executed manually.
But how can I download a file from another server?
Can you give me some sample-code or an URL?
Tnx
Seb
------------------------------
Date: Thu, 27 Jul 2000 23:13:43 +0200
From: Sebastian Erlhofer <Seb.Erlhofer@evc.net>
Subject: download file from another server
Message-Id: <oe91osgbgp5rkmscpk4lnms786k7di4csk@4ax.com>
I want / have to use Tcp/IP
What's NFS and where to get?- sorry knowing perl only for 2 weeks now
:)
Seb
>That depends which protocol you use. I'd suggest to use NFS, then you
>could just copy the file.
>
------------------------------
Date: 27 Jul 2000 16:25:29 EDT
From: abigail@foad.org (Abigail)
Subject: Re: download file from another server
Message-Id: <slrn8o16lh.vcg.abigail@alexandra.foad.org>
Sebastian Erlhofer (Seb.Erlhofer@evc.net) wrote on MMDXXII September
MCMXCIII in <URL:news:mp31os4dv3t9frpg126vlrk4n6j1lk1u9v@4ax.com>:
%%
%% But how can I download a file from another server?
That depends which protocol you use. I'd suggest to use NFS, then you
could just copy the file.
Abigail
--
split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
------------------------------
Date: 27 Jul 2000 17:58:18 EDT
From: abigail@foad.org (Abigail)
Subject: Re: download file from another server
Message-Id: <slrn8o1c3i.vcg.abigail@alexandra.foad.org>
Sebastian Erlhofer (Seb.Erlhofer@evc.net) wrote on MMDXXII September
MCMXCIII in <URL:news:oe91osgbgp5rkmscpk4lnms786k7di4csk@4ax.com>:
^^ I want / have to use Tcp/IP
^^
^^ What's NFS and where to get?- sorry knowing perl only for 2 weeks now
^^ :)
NFS can work over TCP/IP. You'd get it from your local OS vendor.
Abigail
--
BEGIN {$^H {q} = sub {$_ [1] =~ y/S-ZA-IK-O/q-tc-fe-m/d; $_ [1]}; $^H = 0x28100}
print "Just another PYTHON hacker\n";
------------------------------
Date: 27 Jul 2000 14:07:31 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Expanding lists of ranges of integers 1-3,5-8,9,13-14
Message-Id: <slrn8o0uiq.vcg.abigail@alexandra.foad.org>
Eric Kuritzky (kuritzky@math.berkeley.edu) wrote on MMDXXII September
MCMXCIII in <URL:news:8lptaa$mcr$1@agate.berkeley.edu>:
^^ In article <8lor1t$1p$1@nnrp02.primenet.com>,
^^ Jim Monty <monty@primenet.com> wrote:
^^ >Not long ago on the Fun With Perl mailing list, there was an
^^ >impromptu Perl golf challenge to expand lists of ranges of integers,
^^ >e.g., to transform the string
^^ >
^^ > '1-3,5-8,10,13-14'
^^ >
^^ >into the list
^^ >
^^ > (1, 2, 3, 5, 6, 7, 8, 10, 13, 14)
^^ >
^^ >Of course TMTOWTDI, but what's the canonical way?
^^ >
^^
^^ If you think evals are yucky (even when they look like
^^ s/PATTERN/STRING/e), you can do:
^^
^^ $_="1-3,5-8,10,13-14";
^^ @list=map {my @y=split /-/;$y[0]..$y[-1]}split /,/,$_;
Or to save on strokes:
$_="1-3,5-8,10,13-14";
@list=map{split/-/;$_[0]..$_[-1]}split/,/;
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)}; # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
------------------------------
Date: Thu, 27 Jul 2000 20:05:09 +0200
From: Sebastian Erlhofer <Seb.Erlhofer@evc.net>
Subject: flatfile storage
Message-Id: <sbu0osknmktnibrpum495e77vd985tqcrn@4ax.com>
>use DBD::RAM;
>
>Available on the CPAN.
Whats that? :)
I have a hosted server, so the solution has to be in a way that I can
install it myself (that means in my cgi-bin).
I cannot use the SQL port.. :(
Tnx
Seb
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3823
**************************************