[13870] in Perl-Users-Digest
Perl-Users Digest, Issue: 1280 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 4 15:10:30 1999
Date: Thu, 4 Nov 1999 12:10:22 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <941746222-v9-i1280@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 Nov 1999 Volume: 9 Number: 1280
Today's topics:
nothing to do with perl (was Re: Who is worse: Cops or <uri@sysarch.com>
ole - activeperl rclauer@my-deja.com
Re: Perl and commonsense part 2 lee.lindley@bigfoot.com
Re: Perl and commonsense part 2 (Kragen Sitaker)
Re: Perl and commonsense part 2 (Kragen Sitaker)
Re: Perl and commonsense part 2 <flavell@a5.ph.gla.ac.uk>
Re: Perl and commonsense part 2 (David H. Adler)
Re: perl and commonsense (Kragen Sitaker)
Re: perl and commonsense (Kragen Sitaker)
Re: perl and commonsense (Bart Lateur)
Re: perl and commonsense (David H. Adler)
Re: perl and commonsense (David H. Adler)
Perl Help <alan@nospam.com>
Re: Perl modules to build Explorer-like HTML GUI?? <rootbeer@redcat.com>
Re: Problem Retrieving a File Date <rootbeer@redcat.com>
Re: Problem Retrieving a File Date (Bill Feidt)
Re: Problem Retrieving a File Date <rootbeer@redcat.com>
Re: proposed "??" operator causing ambiguous syntax (Alan Curry)
Re: Q: digit-wise number comparisons ? <courcoul@campus.qro.itesm.mx>
Re: replace " " with (Kragen Sitaker)
Re: replace " " with (Craig Berry)
Re: replace " " with (Craig Berry)
Re: robust telnet solution? <fisherm@indy.tce.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 04 Nov 1999 13:17:03 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: nothing to do with perl (was Re: Who is worse: Cops or Criminals)
Message-Id: <x7r9i66s0w.fsf_-_@home.sysarch.com>
why did this thread get into c.l.p.misc? keep it out of here or we will
make all your servers run only cobol.
followups set to remove perl
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 04 Nov 1999 17:06:18 GMT
From: rclauer@my-deja.com
Subject: ole - activeperl
Message-Id: <7vsee6$168$1@nnrp1.deja.com>
Anyone know how to call the Kodak imaging OCX
object from Activeperl?
Thanks,
Rob Lauer
rlauer@cji.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 4 Nov 1999 16:50:42 GMT
From: lee.lindley@bigfoot.com
Subject: Re: Perl and commonsense part 2
Message-Id: <7vsdh2$k25$1@rguxd.viasystems.com>
ajmayo@my-deja.com wrote:
:>In article <7vphkm$tap$1@nnrp1.deja.com>,
:> ajmayo@my-deja.com wrote:
[snip]
:>This kind of attitude - this kind of unskilled labour - results in
:>crappy software. Just look at (insert company here).
:>I don't deny it. But the problem is, folks, that there aren't enough
:>alpha geeks to go around. They can't (yet) be bred to meet
:>requirements. Being a top-notch developer is something you're just born
:>with, I think. Its like having musical talent. Either you got it, or
:>you ain't. So the insatiable demand for developers has to be met,
:>sometimes, with people who can't leap over tall buildings in a single
:>bound. They sometimes need a bit of a runup, or perhaps the building
:>better not be too tall.
There are enough to go around to businesses who are willing to pay
for them. Supply and demand theories still work.
But you don't need everyone to be an "alpha geek". You just need
enough around to help the others over the hurdles.
:>How do I explain to these folks that assignments in perl are subtle;
:>that perl sometimes returns things in scalar context and sometimes in
:>list context - and what the rules are (yes, I know this is explained,
:>sort of, in the online help). That the peculiar tilde ~ operator (is it
:>an operator, exactly?) binds a match operation to the lhs (now, let me
:>remember, was it =~ or ~=)?. That debugging will be a bit painful
:>because you won't get the context - just a line number and an error
:>message. That you can't take a reference to a list (why not, by the
:>way?). And so on.
You do it by patiently reviewing what they write and showing them a
better way and going over that "list vs. scalar context thing" again
and again until they get it. In other words, you do it the same way
you teach them about pointers and references in C -- lots of examples
and repetition.
I'll reiterate my first answer to your original post. You are very
close to being over the hurdle. Your teammates may take longer,
but it is worth it. Once over the hurdle with Perl, productivity
goes way up.
As for a book for someone with your background, the Cookbook is one
obvious choice. Another that came out recently to some good reviews
for someone who is already a programmer but new to Perl is "Perl: the
Programmers Companion" or something like that by Nigel Chapman
(sp?). Strangely I can't find a link to it right now. The cookbook
I can recommend personally. There are several aimed at
mod_perl users.
Find some book reviews at http://www.sysarch.com/cgi-bin/perl_books
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: Thu, 04 Nov 1999 17:24:17 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl and commonsense part 2
Message-Id: <5jjU3.27843$23.1470853@typ11.nn.bcandid.com>
In article <kusn1suckol.fsf@strange.bu.edu>,
Scott Lanning <slanning@bu.edu> wrote:
>kragen@dnaco.net (Kragen Sitaker) writes:
>> In FORTRAN you can do anything if you make a big enough array :)
>
>Fortran 90 r0x d00d..
F90 is a totally different language for purposes of this discussion,
d00d, and one I don't know enough about to discuss competently. I was
thinking of F77.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 04 Nov 1999 18:33:52 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl and commonsense part 2
Message-Id: <kkkU3.27983$23.1478192@typ11.nn.bcandid.com>
In article <7vs1s0$mmk$1@nnrp1.deja.com>, <ajmayo@my-deja.com> wrote:
>So this leaves perl as the other server-side programming language. It
>sure has all the attributes, on paper. Wide platform support, all the
>infrastructure like database access, object-oriented, packages, fairly
>fast and reasonably efficient.
By the way, I think Python has a lot of this, too. It might be more to
your taste.
>So I am not ashamed, at times, to be a 'cut and paste programmer' as
>someone snidely remarked. I have to produce a solution. If Boyer and
>Moore solved the string comparison problem optimally, and Lempel, Ziv
>and Welch can come up with an efficient compression algorithm, why
>shouldn't I cut and paste their solution?.
Well, in the latter case, because Unisys will come asking you for a
license fee. But that's sort of beside the point.
>Its not that I am not
>interested in clean and efficient algorithms. Its just that, when
>you're working under Internet time, the life of a piece of code, or
>even a whole product, can be very ephemeral.
The boundary between the ephemeral and the eternal is ephemeral in
software. :)
>How do I explain to these folks that assignments in perl are subtle;
>that perl sometimes returns things in scalar context and sometimes in
>list context - and what the rules are (yes, I know this is explained,
>sort of, in the online help).
Well, you have to explain scalar and list context.
>That the peculiar tilde ~ operator (is it
>an operator, exactly?)
No. =~ and !~ are operators. ~ by itself is an operator too, but it
is unary and means something totally different:
#!/usr/bin/perl -w
my $x = 'HELLO THERE' ^ ("\x80" x 11);
print ~$x, "\n";
This outputs:
7:330_+7:-:
>Subtle and clever languages have always been around, of course. LISP,
>Prolog and Smalltalk spring to mind. But its the simple, unsubtle and
>unclever languages that have been most popular. COBOL, BASIC and C, for
>example. This, I think, is because so many of us just aren't subtle and
>clever enough.
LISP is a fair comparison, I think. Prolog and Smalltalk are intended
to be simple, orthogonal, and small languages.
What do you think of Steele's remarks in the talk I cited?
>I remember getting into C++ via Microsoft's excellent tutorial. Around
>page 40 or so, they start getting into building a simple string class.
>The discussion goes a bit like this. "you might think this
>implementation is complete. But there is a subtle problem..... having
>changed this, you might think this implementation is complete. But
>there is a subtle problem ....." and so on, until, several iterations
>later the 'simple' string class bristles with checks for all the subtle
>problems. The thing is, programming is difficult enough without subtle
>problems.
This is the big problem with C++. I don't think Perl has this
problem. Do you? I'd be interested to hear examples.
(Hmm, well, local() and $_ are fertile ground for such problems. Don't
use local if you can help it, and don't use $_ in subroutines unless
you know what you're doing (which means using local()).)
>I *do* read the Perl books. I *do* read the online documentation. I
>*do* trawl the newsgroups. But what I can't find is documentation that
>is targetted at what makes perl different. My first attempts to learn
>perl centred round Larry's original book with, as I recall, the three
>wise men travelling across the desert laden with frankincense and
>myrrh. Or something like that. It was so insufferably cute that I
>couldn't cope with it. Then I tried the O'Reilly reference. It is ok,
>as far as it goes. But too much of this stuff assumes you're going to
>learn computer programming with perl as your first language. Gather
>round, children. Now, when you want the computer to do something more
>than once, you use something called a 'loop'... and so on.
I learned Perl from the perl4 man page and some friends' scripts, and
then the FAQ. I think the perl5 man pages are too big to do this.
>Can someone point me at some coherent documentation that brings
>together the perl philosophy assuming I am a competent programmer in
>other languages (I will make the assumption that I *am*, thanks. They
>are still paying me, so I am going to assume my code doesn't stink too
>badly).
>
>In particular, documentation absolutely *replete* with examples. Yes,
>cut and paste code. Yes, I know.
_Perl: A Programmer's Companion_ is pretty good. Someone recently
recommended _Elements of Programming with Perl_, which I haven't read.
I've heard good things about _Effective Perl Programming_.
>Meanwhile, and this is the crux of the issue, I have little choice
>about whether or not to use perl. I pretty much *have* to. This makes
>discussions on the orthogonality of perl rather relevant, I think.
Do you mean that if enough people decide Perl is too, um, diagonal,
then they will come up with a more orthogonal language? Is that what
you mean by 'relevant'?
>It is becoming a very pervasive language. Will it prove to be a good tool
>or is it too subtle and clever for its own good, with too many disjoint
>features. Occam once said 'never multiply entities unnecessarily'. In
>perl, I think the entities are starting to get out of hand. What do you
>think?
Perl has many unnecessary entities, by design. Occam's razor is
terrific for evaluating explanations of observed phenomena. It's not
so good for evaluating languages, for programming or otherwise.
If you really like Occam's razor, there's this nifty language called
the lambda calculus . . . :)
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 4 Nov 1999 18:21:54 +0000
From: "Alan J. Flavell" <flavell@a5.ph.gla.ac.uk>
Subject: Re: Perl and commonsense part 2
Message-Id: <Pine.OSF.4.20.9911041817500.6104-100000@a5.ph.gla.ac.uk>
On Thu, 4 Nov 1999, Kragen Sitaker wrote:
> F90 is a totally different language for purposes of this discussion,
Probably true. But physicists write FORTRAN in any language.
(a quotable quote that I heard at CERN a few years back, but it's
still uncannily true. A colleague showed me an allegedly C++ source
the other day, but although written to C++ syntax, it was still
very obviously a FORTRAN program at heart!)
------------------------------
Date: 4 Nov 1999 14:39:42 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: Perl and commonsense part 2
Message-Id: <slrn823o7u.e4q.dha@panix.com>
On Wed, 03 Nov 1999 14:42:31 GMT, ajmayo@my-deja.com
<ajmayo@my-deja.com> wrote:
>Further to my previous post. My colleague asked me how you would
>combine two hashes to create a single hash.
>
>Well, this is simple with two arrays. Just use push..
[snip]
>So, let's use commonsense. To do the same with two hashes, you'd do
>this, right?
'commonsense' only goes so far.
This use of the term strikes me as being much like thinking that
because screws and nails are both fastening devices, you should be
able to use a screwdriver on a nail. Needless to say, this does not
work. :-/
I think it servers us well to remember the highly slippery nature of
analogy.
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"What is this Japanese preoccupation with the name Ken???" - Tom Servo
------------------------------
Date: Thu, 04 Nov 1999 17:30:24 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: perl and commonsense
Message-Id: <QojU3.27853$23.1471297@typ11.nn.bcandid.com>
In article <MPG.128b4113342e581b98a19f@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <vvgU3.1215$c06.13481@news.rdc1.ct.home.com> on Thu, 04 Nov
>1999 14:12:43 GMT, Dan Sugalski <dan@tuatha.sidhe.org> says...
>...
>> Nope. List involved. Most of the values are still thrown away, but the
>> list is built. A list in scalar context returns the last element of the
>> list.
>
>It has been stated here repeatedly (usually in capital letters :-) that
>there is no such thing as a 'list in scalar context'. There is a
>sequence of expressions, separated by the comma operator, but no list is
>built.
Well, that's what I thought, too. Can you fix perldoc perldata? It
says:
If you evaluate a named array in a scalar context, it
returns the length of the array. (Note that this is not
true of lists, which return the last value, like the C comma
operator, nor of built-in functions, which return whatever
they feel like returning.) The following is always true:
And it doesn't explain what an array slice returns in scalar context,
either.
>> Not to be confused with list *assignment* in scalar context, of course,
>> which returns the number of values in the RHS of the list.
>
>Surely you mean 'array assignment', not 'list assignment'.
So what's up with my $x = () = (1,2,3,@foo,@bar,'fish');?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 04 Nov 1999 17:47:20 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: perl and commonsense
Message-Id: <IEjU3.27871$23.1473633@typ11.nn.bcandid.com>
In article <1e0pfh8.sp8ixy1i6qsh4N%kpreid@ibm.net>,
Kevin Reid <kpreid@ibm.net> wrote:
>Kragen Sitaker <kragen@dnaco.net> wrote:
>> >Well here's one thing you got right. "Use of uninitialized value at (eval
>> >8) line 20" is totally useless.
>>
>> Yuck. Is that really what mod_perl does? I guess we need a #line
>> directive for Perl.
>
>It already has one. See "Plain Old Comments (Not!)" in perlsyn.
>
>The problem here is that mod_perl isn't using it.
Actually, I posted that I'd found that earlier today. It doesn't seem
to work all the time with eval STRING. Try this in 5.005_03:
#!/usr/bin/perl -w
eval "#line 300 bobo.pl\n)\n";
warn $@ if $@;
So maybe it's not mod_perl's fault, since mod_perl has to eval STRING.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 04 Nov 1999 17:55:08 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: perl and commonsense
Message-Id: <3825c3cf.2557253@news.skynet.be>
ajmayo@my-deja.com wrote:
> I want to see the error reported in context e.g
>
>$foo=$bar+$glarch;
> ^undefined variable $bar
>
>like I would in most development environments.
Not a bad thought. I often wish perl would tell me WHICH variable is
undefined, instead of just saying "use of undefined variable" (or
"value"?). This is most badly need in cases of interpolation in long
strings, like:
print <<EOT;
blah blah first $variable here
more blah $another variable
....
EOT
Perl just points to the line of the print statement.
Of course, Perl knows only of *values*, not of variables (e.g. you can
use a dereference of a reference to a scalar), so actually reporting the
name of the variable is impossible (or at least impractical).
Second best would be if WE could decide what value undef() would be
replaced with, instead of just an empty string, so that for example, the
code:
$^H{undef} = "###UNDEF###"; # randomly picked example variable
undef $undefined;
print "This is $undefined.";
would print
This is ###UNDEF###.
All you'd have to do is look at the output, and it would immediately
jump into your face what value was not defined. Now, I think, *that*
would be a great debugging help.
--
Bart.
------------------------------
Date: 4 Nov 1999 14:18:33 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: perl and commonsense
Message-Id: <slrn823n05.e4q.dha@panix.com>
On Wed, 03 Nov 1999 13:40:49 -0500, brian d foy <brian@smithrenaud.com> wrote:
>
>Perl may be for accidental programmers, but it's also a power tool
>(or a dessert topping as dha would say).
Nah, today I'm feeling like it's more floor wax-y. :-)
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
People don't buy our products because they want a 1/2 inch drill, they
buy our products because they want a 1/2 inch hole.
- reportedly, some exec at Black and Decker
------------------------------
Date: 4 Nov 1999 14:33:44 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: perl and commonsense
Message-Id: <slrn823nso.e4q.dha@panix.com>
On Thu, 4 Nov 1999 11:07:18 -0500, shapirojNOSPAM@logica.com
<shapirojNOSPAM@logica.com> wrote:
>
> - How should one do what ajmayo want to do? Perl coders seem to suffer
>from 'one-line-osis'. The following seems to work for me
>
>my @a = qw/one two three four five/;
>my @b = @a[0 .. 2];
>my $z = \@b;
>
>Unless you want to be able to, say,
> $z->[1] = "zwei", and have $a[1] eq "zwei", this should work for you.
If, as you say, you just want to refer to an array of values and don't
need to actually affect the values of the original array, you could
just do this:
my $z = [ @a[0..2] ];
i. e. use the anonymous array constructor. Again, this all really
depends on what you're trying to do... worlds within worlds... :-)
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Last year in Oregon, Summer fell on a *tuesday*. That was it. One
day. Big shiny thing in the sky. Some people thought it was a UFO."
- Randal Schwartz in comp.lang.perl.misc
------------------------------
Date: Thu, 4 Nov 1999 14:31:02 -0800
From: "Alan" <alan@nospam.com>
Subject: Perl Help
Message-Id: <PhlU3.44081$5W2.1000861@news6.giganews.com>
All,
I need a little direction on this. I'm still sort of new to perl programming
and have written some
small simple scripts but this one I'm not real sure how to attack so any
input to web sites, books,
or similar scripts would be appreciated.
I need to write a script to read a text file search for a specific line if
its there and modify the line.
If the line is not in the text file then I need to add it. Any thoughts?
Thanks,
Alan
------------------------------
Date: Thu, 4 Nov 1999 10:39:59 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl modules to build Explorer-like HTML GUI??
Message-Id: <Pine.GSO.4.10.9911041029320.29670-100000@user2.teleport.com>
On Thu, 4 Nov 1999, Shmooth wrote:
> I browsed through the Perl Modules on CPAN, but couldn't really find
> the two things I think I'd need:
>
> 1) A 'list of lists'-type module - ideally with some functions like
> add(), remove(), expand(), collapse(), etc.
I don't know what those functions would do, but it sure sounds like an
interesting module. :-) (Could any of those be splice() in disguise? Or
are you doing some kind of outline view, where a branch of the hierarchy
can be viewed or hidden?)
> 2) An HTML-type module that can display the tree (and possibly help to
> maintain state between pages, or at least, have a scheme to maintain
> state between cgi invocations -> like which parameters to pass and what
> they contain, e.g. @expanded_list =
> ("/MainBranch/Subbranch/etc.","/OtherBranch/Books")
This too, sounds like it could be interesting to see, despite the fact
that I don't understand it. Much like Fiona Apple.
Be sure, if you're making something that's trying to make a display in
HTML, that it doesn't rely upon the idiosyncrasies of one or two browsers
in order to work. Make it work with all standard browsers, including
non-graphical ones. That way, even people with too much money, the ones
who can afford to buy and use one of those cell phones that access the
web, will be able to use your program.
When you have these modules finished, be sure to put them on CPAN. Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 4 Nov 1999 10:29:03 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Problem Retrieving a File Date
Message-Id: <Pine.GSO.4.10.9911041027260.29670-100000@user2.teleport.com>
On Thu, 4 Nov 1999, Bill Feidt wrote:
> However, if I set $curfile to "J19991014f04.html" (as in: $curfile =
> "J19991014f04.html"), an incorrect and inexplicable (to me anyway)
> date is returned.
Maybe stat() is failing and the "date" you have is undef? But if that's
not it, could you show us the inexplicable date so that we can try to make
it explicable? :-)
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 04 Nov 1999 18:39:40 GMT
From: wfeidt@cpcug.org (Bill Feidt)
Subject: Re: Problem Retrieving a File Date
Message-Id: <3821d2e6.0@news4.his.com>
In article <Pine.GSO.4.10.9911041027260.29670-100000@user2.teleport.com>, Tom Phoenix <rootbeer@redcat.com> wrote:
>On Thu, 4 Nov 1999, Bill Feidt wrote:
>
>> However, if I set $curfile to "J19991014f04.html" (as in: $curfile =
>> "J19991014f04.html"), an incorrect and inexplicable (to me anyway)
>> date is returned.
>
>Maybe stat() is failing and the "date" you have is undef? But if that's
>not it, could you show us the inexplicable date so that we can try to make
>it explicable? :-)
Thanks Tom. Don't think stat() is failing. It returns a plausible date, but
incorrect. Here's the program:
#!/bin/perl -w
#
#Comments
$tm = time;
print $tm, "\n";
$now = localtime($tm);
print $now, "\n";
$curfile = "J19991014f04.html";
($READTIME, $WRITETIME) = (stat($curfile))[8,9];
$then = localtime($READTIME);
print $then, "\n";
$diff = $tm-$READTIME;
print $diff, "\n";
Here's the output when I run the program:
Name "main::WRITETIME" used only once: possible typo at test1.pl line 11.
941740211
Thu Nov 4 13:30:11 1999
Thu Nov 4 11:11:50 1999
8301
And here's a directory listing for the file, showing the correct file date:
2563 Oct 27 12:12 J19991014f04.html
Thanks again for any possible help.
Bill
wfeidt@agnic.org
------------------------------
Date: Thu, 4 Nov 1999 10:58:39 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Problem Retrieving a File Date
Message-Id: <Pine.GSO.4.10.9911041057040.29670-100000@user2.teleport.com>
On Thu, 4 Nov 1999, Bill Feidt wrote:
> Thu Nov 4 11:11:50 1999
I think that's the atime (access time)....
> And here's a directory listing for the file, showing the correct file date:
>
> 2563 Oct 27 12:12 J19991014f04.html
...and that this is the mtime (modification time). See your stat(2)
manpage for more information on what it returns. Does that help? Good luck
with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 04 Nov 1999 19:36:43 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: proposed "??" operator causing ambiguous syntax
Message-Id: <fflU3.28110$23.1484960@typ11.nn.bcandid.com>
In article <slrn822t5g.dk.abigail@alexandra.delanet.com>,
Abigail <abigail@delanet.com> wrote:
>$x??$pat?-1:1 has now a well defined meaning. If ?? would be introduced,
>$x??$pat?-1:1 still has a well defined meaning - but it will mean something
>different.
It doesn't have to mean something different. The parser could favor the old
meaning (and issue a warning like "ambiguous use of ?? interpreted as pattern
matching inside conditional")
The perldiag(1) entry for that warning could say:
If you are getting this warning, you know exactly what you did and you
should be ashamed of yourself.
or
You've won the lotto! Well, not really, but that's more likely than getting
this warning.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Thu, 4 Nov 1999 11:32:10 -0600
From: "Juan M. Courcoul" <courcoul@campus.qro.itesm.mx>
To: Tye McQueen <tye@metronet.com>
Subject: Re: Q: digit-wise number comparisons ?
Message-Id: <Pine.GSO.4.10.9911041127080.15891-100000@campus>
Thanks for your solution. I'll try it out and hopefully be done with the
problem before the number of different codes gets too large and the
algorithm 'saturates'.
Like I told Ilya, what I need is to generate long-distance id-codes for
our Nortel PBX and I want to make it difficult for a legitimate user to
'discover' another code (perhaps with greater privileges than his/her
own), by virtue of an accidental slip of the finger.
Perhaps I could further complicate my existence (;) ) by determining which
numbers are 'similar' due to their placement on the phone's keypad...
Thanks again,
J. Courcoul
On Mon, 25 Oct 1999, Tye McQueen wrote:
> [Posted and e-mailed.]
>
> "Juan M. Courcoul" <courcoul@campus.qro.itesm.mx> writes:
> ) In order to assign access controls to a group of people, I need to generate a
> ) largeish (> 1,500) number of random six-digit numerical access codes. Simple
> ) enough; however, I need the codes to differ by at least two digits in any of
> ) the six places.
>
> I tried for no 3 digits the same, but after about 300 six-digit
> IDs the search got too slow. I wonder what the sizes are of the
> largest and smallest sets of 6 digit IDs were no two have 2 (or
> 3) digits in common and no IDs can be added to the set without
> breaking that property.
>
> Anyway, your problem sounded interesting and I had a solution in
> just a few minutes so here it is, free and worth every penny. I
> added the requirement that IDs can't have leading zeros because
> it made sense and saved me from doing C<sprintf>.
>
> My choice of solutions was to have a hash to track each of the
> 15 possible choices of 4 subdigits and, for each candidate, I made
> sure it didn't have a conflict in any of the 15 hashes.
>
> I could have gotten by with, for example, about 7 hashes using
> 3-digit keys (any number with a conflict in one of the 15 hashes
> will also have a conflict in at least 4 others) but that would
> have increased the time required for me to write the script much
> more than it would have hastened the search for 1500 IDs.
>
> #!/usr/bin/perl -w
> use strict;
> my @comb;
> exit main();
> sub find {
> my $id= 100_000 + int 900_000*rand;
> my @id= split //, $id;
> my( $a, $b, $c, $d, $sub );
> my $i= 0;
> for $a ( 0..2 ) {
> for $b ( 1+$a..3 ) {
> for $c ( 1+$b..4 ) {
> for $d ( 1+$c..5 ) {
> $sub= join "", @id[$a,$b,$c,$d];
> if( $comb[$i]->{$sub} ) {
> #warn "Rejected $id: too similar to ",
> # $comb[$i]->{$sub}, " [index $i=$a,$b,$c,$d]\n";
> return -$id;
> }
> $i++;
> }
> }
> }
> }
> $i= 0;
> for $a ( 0..2 ) {
> for $b ( 1+$a..3 ) {
> for $c ( 1+$b..4 ) {
> for $d ( 1+$c..5 ) {
> $sub= join "", @id[$a,$b,$c,$d];
> $comb[$i]->{$sub}= $id;
> $i++;
> }
> }
> }
> }
> return $id;
> }
> sub main {
> my $need= 15000;
> my $rejects= 0;
> my @found;
> while( @found < $need ) {
> my $next= find();
> if( 0 < $next ) {
> warn "Found $next (",0+@found," of $need, $rejects rejects).\n";
> push @found, $next;
> $rejects= 0;
> } else {
> $rejects++;
> }
> }
> return 0;
> }
> --
> Tye McQueen Nothing is obvious unless you are overlooking something
> http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
>
------------------------------
Date: Thu, 04 Nov 1999 17:16:02 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: replace " " with
Message-Id: <mbjU3.27831$23.1469679@typ11.nn.bcandid.com>
In article <m1vh7iuvmx.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Kragen" == Kragen Sitaker <kragen@dnaco.net> writes:
>Kragen> I would be so much happier if you would just use <blockquote>. I hate
>Kragen> nbsp and I hate people who use it. (Well, maybe not quite.)
>
>I would be so much happier if you would just use <pre> and stop using
><blockquote> for something it wasn't intended, and I hate people who
>use it (well, maybe not quite).
>
>:-)
>
>If you want <pre>-like behavior but not the courier font, use Styles.
>That's what they're there for.
That's a great idea.
I suppose I was thinking that when people posted indented text, it
would be because it *was* a block quote -- I don't endorse blockquote
perversion either.
Your style alternative is probably good, after Netscape 5.0 comes out.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 04 Nov 1999 19:55:01 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: replace " " with
Message-Id: <s23p4ld62428@corp.supernews.com>
Blair Heuer (ab@cd.com) wrote:
: I am not too good with simple search and replace, and what i need is not
: simple, in my mind, so I hope someone can help me.
It actually is moderately simple, as Perl search-and-replace problems go.
I strongly suggest you get _Learning Perl_ (the "Llama Book") and read it,
trying out the examples and exploring on your own with what you learn.
Your time and effort will be abundantly rewarded.
: I need a line, or lines, of code that will take each element in a list,
: check for any leading spaces, and change those into non-breaking spaces
: ( ).
:
: I know I will need something like:
:
: foreach $item (@list) {
: search replace code
: }
Good pseudocode so far. Now, let's take apart your specification for what
to change:
: But I have no clue how to tell it to change all " " to " " until there
: is not a " " then stop and go to the next.
: Basically if i had the line (without quotes) " Hello World!" I would want
: the code to change it to " Hello World!"
To rephrase this in more regex-friendly terms: "Find any spaces at the
beginning of the string, and turn each of them into ' '.
The phrase 'beginning of the string' tells you that you will probably be
using ^, the start-of-string pattern anchor. Now the problem is how to
convert a sequence of N spaces following that anchor into N copies of
' '. Here's one way:
$line =~ s/^( +)/' ' x length $1/e;
This basically says "match a series of spaces beginning at the start of
the string, and replace it with a number of copies of ' ' equal to
the length of the matched series of spaces."
Here's another way to do it:
$line =~ s/\G / /g;
This says "Starting where the last match ended (initially, at the
beginning of the string), try to match a space. If you succeed, replace
it with ' '. Repeat until the match-space-after-last-match step
fails."
: I hope that the non-breaking spaces were not interpreted as merely " " so
: you can see what i was writing.
You'll find that most people using this newsgroup consider HTML "enhanced"
email clients to be a plague upon the earth. ;)
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Thu, 04 Nov 1999 19:56:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: replace " " with
Message-Id: <s23p76ha24283@corp.supernews.com>
David Efflandt (efflandt@xnet.com) wrote:
: Perhaps you should start by typing 'perldoc perlre' (without quotes) on a
: system with Perl on it. This is a simple search and replace:
:
: foreach (@list) { s/ / /g; }
Your solution (and its cousins which I've snipped) fail to meet the
requirement that only string-initial spaces be converted.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Thu, 4 Nov 1999 12:30:26 -0500
From: "Mark Leighton Fisher" <fisherm@indy.tce.com>
Subject: Re: robust telnet solution?
Message-Id: <3821c2b2@news.tce.com>
> Is there a module and or method which ensures proper echoing of characters
> when writing an interactive client/server app in perl or any other
language?
Look at Net::Telnet in CPAN (http://www.perl.com/CPAN). CPAN is your
friend -- use it!
==========================================================
Mark Leighton Fisher Thomson Consumer Electronics
fisherm@tce.com Indianapolis, IN
"Browser Torture Specialist, First Class"
------------------------------
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 1280
**************************************