[6736] in Perl-Users-Digest
Perl-Users Digest, Issue: 361 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 24 08:07:21 1997
Date: Thu, 24 Apr 97 04:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 24 Apr 1997 Volume: 8 Number: 361
Today's topics:
Re: A simple substitution <tom@eiscat.uit.no>
Re: Any graphic module available? <dehon_olivier@jpmorgan.com>
Clearing output buffer (Niksun)
Clearing the browser screen (Niksun)
Day of the week (Mark Guz)
Re: deleting the current element from a list <jwilson@ic.ac.uk>
Re: Get Chars up to first | without splitting <a.aitken@unl.ac.uk>
Host your WEB DESIGNS and organize WEB OFFICES with our <ayurkina@adgrafix.com>
Re: How to match an * (Tad McClellan)
How to not escape a query string when 'Posting' with LW (JP Crametz)
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <sef@clyde.boltz.cs.cmu.edu>
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <fellowsd.cs@man.ac.uk>
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th (Cyber Surfer)
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <wclodius@lanl.gov>
Re: Mac version of Perl ... <neeri@iis.ee.ethz.ch>
Re: No syntax errors, but still the thing won't run (Kyzer)
Re: Perl as its own metalanguage? <lpa@sysdeco.no>
Re: PERL Editor (Kyzer)
Re: switch and if <igandham@prestel.net>
Re: switch and if <a.aitken@unl.ac.uk>
Re: sysopen object method in perl 5.001? <a.aitken@unl.ac.uk>
Re: sysopen object method in perl 5.001? <tchrist@mox.perl.com>
Re: www-based e-mail <santiago@gambito.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Apr 1997 11:39:05 +0200
From: Tom Grydeland <tom@eiscat.uit.no>
Subject: Re: A simple substitution
Message-Id: <tru3kw2212.fsf@eiscat.uit.no>
Nathan Torkington <gnat@elara.frii.com> writes:
> abigail@fnx.com (Abigail) writes:
> > What's wrong with "tr/a-z\xe0-\xf6\xf8-\xfe/A-Z\xc0-\xd6\xd8-\xde/;"?
> You assume a particular character set. Those may not be the write
> values for people with Swedish, German, Japanese, etc, character sets.
> For single-byte encodings, getting your locale (man perllocale)
> working is the easiest way to make "word characters" and "non-word
> characters" work (as well as uc, etc).
I'd wish people stopped refering to the perllocale manpage until it's
part of the standard distribution, or at least point out that this
particular manpage is only in the 5.004 beta release.
Perl v. 5.003 does not like LANG or LC_* to be set (at least not on my
machine) and other programs won't let me use Norwegian characters
without these variables set, so I've ended up having aliases that set
and unset all of the locale-related variables. It's nuts, but it works.
I was given a similar clue on no.perl, and I ended up searching my
entire perl installation several times, all over CPAN, and only when I
downloaded the (then unsupported alpha) 5.004 did the name perllocale
suddenly appear.
> Nat
--
//Tom dot Grydeland at phys dot uit dot no
The case of Randal Schwartz - http://www.lightlink.com/fors/
------------------------------
Date: 24 Apr 1997 10:47:41 +0100
From: Olivier Dehon <dehon_olivier@jpmorgan.com>
Subject: Re: Any graphic module available?
Message-Id: <njzrag021mq.fsf@jpmorgan.com>
gis84514@cis.nctu.edu.tw (fish) writes:
>
> Hello..
>
> I use perl to write CGI programs, it will process some data and then
> draw a graph and send back to the browser..
> Is there any module that can handle this?
> I know pgerl, but it require fortan compiler....
> and gnuplot can't draw gif file....
> any other available? Thanks a lot!
GD.pm, available from the CPAN.
I used it successfully to do a similar job.
Hope this helps.
Olivier Dehon.
------------------------------
Date: Thu, 24 Apr 1997 06:08:54 GMT
From: niksun@lconn.net (Niksun)
Subject: Clearing output buffer
Message-Id: <335ef8a9.22323079@news.inetw.net>
How can I clear the output buffer of a browser window so that I can
clear the browser page and write new text to it? An example of this
is at http://www.metacrawler.com - do a query there and you'll see
what I mean.
Niksun
------------------------------
Date: Thu, 24 Apr 1997 04:01:13 GMT
From: niksun@lconn.net (Niksun)
Subject: Clearing the browser screen
Message-Id: <335ed6da.13666912@news.inetw.net>
With Perl, I want to be able to print some HTML in the user's browser
window, clear their browser window, and then type in some more text.
An example is MetaCrawler (http://www.metacrawler.com). Do a search
there and you'll notice that once you submit your query, it shows you
the amount of references returned from certain other search engines.
Once it has "culled" all references, it clears the screen and prints
the links. How can I do this in Perl?
Niksun
------------------------------
Date: Thu, 24 Apr 1997 10:18:27 GMT
From: markguz@sol.co.uk (Mark Guz)
Subject: Day of the week
Message-Id: <33603315.88338587@news.sol.co.uk>
I have a text file with a field in there which shows the month and
date(MAR1 or APR2)
I need to convert this to the day of the week that it was
I am stumped?
anyone help?
Regards
Mark Guz
Scotland On Line
------------------------------
Date: 24 Apr 1997 09:51:47 GMT
From: "Jeff Wilson" <jwilson@ic.ac.uk>
Subject: Re: deleting the current element from a list
Message-Id: <01bc5095$1ecf9100$1d34c69b@leicester.cc.ic.ac.uk>
You could let the array assign itself, as follows ...
@list=('aaa','bbb','ccc','ddd','eee','fff','ggg','hhh','iii');
for $n (0..$#list) {print "$list[$n] ";}
print "\n";
for $n (0..$#list) {
if($list[$n] eq "eee" ) {
@list=(@list[0..$n-1],@list[$n+1..$#list]);
}}
for $n (0..$#list) {print "$list[$n] ";}
print "\n";
... it works for any element in the list.
--
Jeff Wilson
CCS ~ Imperial College ~
London UK
Bob Shair <rmshair@uiuc.edu> wrote in article
<5jjt1t$c3l@vixen.cso.uiuc.edu>...
> Is there an elegant (or just good) way to delete the current element
> from a list when in a foreach loop?
>
> I'm merrily foreaching through a list, using
> foreach $MCD (grep(/00000MCD/,@nontriv)) {
> if ($pages{$LCD} == $pages{$MCD}+1) {
>
> at that point, I want to delete $MCD from the @nontriv list.
>
> The difficulty I'm having is that I don't know WHERE in the list I
am.
>
> TIA,
> --
> Bob Shair Open Systems Consultant
> 1018 W. Springfield Avenue rmshair@uiuc.edu
> Champaign, IL 61821 217/356-2684
> < Not employed by or representing the University of Illinois >
>
------------------------------
Date: Thu, 24 Apr 1997 10:59:20 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Get Chars up to first | without splitting
Message-Id: <335F2EF8.7A61@unl.ac.uk>
Tom Phoenix wrote:
> On Wed, 23 Apr 1997, christop@ozinter.co.jp wrote:
> > I've got a text file that contains this -
> > 001|something|something else|and some more
> > - reading into $line a line at a time and I want to just put the 001 bit
> > into $FirstBit.
> > Can I extract the characters up to the first occurrence of | ?
>
> Yes, and Perl can do this in N ways, where N is arbitrarily large and the
> code is arbitrarily ugly. :-) For N=6,
>
> $first = substr $line, index($line, '|');
> ($first) = split /\|/, $line;
> ($first) = $line =~ /^(.*?)\|/;
> $first = $line; chop $first while index($first, '|') > -1;
> $_ = ($first = $line) =~ tr/|//; 1 while chop($first) ne '|' or --$_;
> { my @foo; $_ = $line; push @foo, $_ while length chop;
> $first = (sort { length $b <=> length $a } grep !/\|/, @foo)[0] }
>
> The first is probably as good as anything you can get, but the second
> shouldn't be too bad either. The others are just TMTOWTDI, and I'd avoid
> them no matter how many other people recommend any of them. :-) Hope this
> helps!
Those routines benchmarked:
Code:
#! /usr/local/bin/perl
use Benchmark;
$line = "001|test|string|more";
timethese(100000, {
'name1' => '$first = substr($line,index($line,"|"));',
'name2' => '($first) = split /\|/, $line; ',
'name3' => '($first) = $line =~ /^(.*?)\|/;',
'name4' => '$first = $line; chop $first while index($first, "|")> -1;',
'name5' => '$_ = ($first = $line) =~ tr/|//; 1 while chop($first) ne "|"
or --$_
;',
'name6' => '{ my @foo; $_ = $line; push @foo, $_ while length chop;
$first = (sort { length $b <=> length $a } grep !/\|/, @foo)[0] }'
});
exit 0;
results:
name1: 0 secs ( 1.30 usr 0.00 sys = 1.30 cpu)
name2: 5 secs ( 4.14 usr 0.00 sys = 4.14 cpu)
name3: 5 secs ( 4.33 usr 0.00 sys = 4.33 cpu)
name4: 40 secs (23.25 usr 0.00 sys = 23.25 cpu)
name5: 30 secs (19.77 usr 0.00 sys = 19.77 cpu)
name6: 127 secs (89.82 usr 0.00 sys = 89.82 cpu)
routine 'name3' doesn't look too bad but 4 to 6 are clearly
inappropriate to the task.
um .. TMTOWTDI?
Alastair.
------------------------------
Date: 24 Apr 1997 10:32:59 GMT
From: "Albina Yurkina" <ayurkina@adgrafix.com>
Subject: Host your WEB DESIGNS and organize WEB OFFICES with our Virtual Servers
Message-Id: <01bc5095$4e400960$LocalHost@serg>
Programmers and Web Designers,
You can host your Web Designs and can organize Web Offices using Adgrafix
Virtual Servers. See us at
http://www.adgrafix.com/info/ayurkina
Adgrafix Account Executive
Albina Yurkina
------------------------------
Date: Wed, 23 Apr 1997 22:35:22 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to match an *
Message-Id: <qdkmj5.eu9.ln@localhost>
Mike_and_Beth (mandbx@wco.com) wrote:
: I have a simple text file I want to strip all previously REMMED out
: lines from. The original author used asterisks to begin/mark unused
: lines. ie;If the line starts with a "*" ... delete it. I can't seem to
: get PERL to not use the wildcard or 0 or more literal meaning. I've
: tried $string = "*";
^
That is an assignment. Whatever was in $string isn't there anymore.
You just overwrote it...
: and used the /\Q$string\E/ ...
Kinda looks like you're confused about which is the pattern and
which is the string being searched.
: any suggestions ?
print "starts with asterisk\n" if /^\*/; # escape the asterisk
print "starts with asterisk\n" if /^\Q*/; # escape the asterisk another way
print "starts with asterisk\n" if /^[*]/; # asterisk in a character class
# asterisk is 'meta' in a regex, so test without a regex:
print "starts with asterisk\n" if substr($_, 0, 1) eq '*';
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 24 Apr 1997 00:36:36 -0700
From: crametz@shell3.ba.best.com (JP Crametz)
Subject: How to not escape a query string when 'Posting' with LWP
Message-Id: <5jn2i4$a47@shell3.ba.best.com>
Hi,
I'm trying to do a 'POST' to a cgi-script with the libwww/LWP package
for perl5 and need to pass a query string that in such a way
that \,( and { are _not_ escaped.
I have tried the following 3 experiments and posted the query to a
little dummy cgi script on my site that parses the variables and
returns the environment variables.
1- $url->query('mode1\test{(2)}');
2- $url->equery('mode1\test{(2)}'); (just in case)
3- defining the query directly within the url:
$url= new URI::URL('http://www.whatever.com/junk.cgi?mode1\test{(2)}');
In all 3 cases, my query string appears to have been sent as:
QUERY_STRING=mode1%5Ctest%7B(2)%7D instead of: mode1\test{(2)}
Can anybody tell me how to get rid of those escape characters?
or am I doing something wrong?
Thanks a lot for your input,
JP Crametz
------------------------------
Date: 24 Apr 1997 02:45:56 -0400
From: Scott Fahlman <sef@clyde.boltz.cs.cmu.edu>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <yd3esg6hqz.fsf@CLYDE.BOLTZ.CS.CMU.EDU>
mike@ducky.net (Mike Haertel) writes:
> * LispM's were not multi-user...
>
> * LispM's were not secure...
>
> The LispM's also cost too much--especially for single-user machines!
Also:
The Lisp Machines had a hellacious learning curve. If you could
invest the months required to learn all their tricks, they provided a
software-development environment that has still not been surpassed.
But even some accomplished Lisp programmers never had time to get over
"the hump", and non-Lispers faced a really frightening barrier.
The documentation was designed for people who already knew the answer,
and Symbolics was remarkably unhelpful unless you wanted to spend a
week and a few thousand dollars for a training course.
(This may have become a little better toward the end, but by then it
didn't matter.)
Early MS-DOS was even worse, of course, but there was much less of it
to conquer.
-- Scott
------------------------------
Date: 24 Apr 1997 08:41:19 GMT
From: Donal K. Fellows <fellowsd.cs@man.ac.uk>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <5jn6bf$2hl@m1.cs.man.ac.uk>
[ I'm not quoting the original message, as you can read so many like
it on USENET... ]
Erik, your problem with M. Prasad does not really belong in any of the
groups in the Newsgroups: line, but rather private email or alt.flame
instead [followups set]. I do happen to agree with MP that you are
not doing a particularly good job of advocacy (for that is what you
are doing) and that a more considered style of correspondence would be
more likely to be successful. In particular, your "facts" often seem
to be either inaccurate, wrong or irrelevant to the discussion (which
has wandered a long way from comp.lang.tcl's charter too).
Donal.
--
Donal K. Fellows http://r8h.cs.man.ac.uk:8000/ (SAY NO TO COMMERCIAL SPAMS!)
(work) fellowsd@cs.man.ac.uk Dept. Comp. Sci, Univ. Manchester, U.K.
| donal@ugglan.demon.co.uk 6,Randall Place, Heaton, Bradford, U.K. (home)
+-> ++44-161-275-6137 Send correspondence to my office ++44-1274-401017 <-+
------------------------------
Date: Thu, 24 Apr 1997 10:20:56 +0100
From: cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer)
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <MPG.dc91c2f50bc979798979d@news.demon.co.uk>
With a mighty <335E4E2F.776E@polaroid.com>,
prasadm@polaroid.com uttered these wise words...
> Is it just my perception, or does this gent really
> have a severe attitude problem?
He's making a valid point: study the reasons for the failures and
learn from them. Lucid failed for purely business reasons, not
anything technical. I doubt that MS, for example, will fail for the
same reasons, but perhaps 15 years ago, when they were much smaller,
they could've. The lesson here may to be take great care when entering
a new market (e.g. C compilers).
On the hardware front, CCC failed not because the Cray 4 didn't work
(apparently it _did_ work), but because they ran out of money before
finding their first customer. Ask any of the ex-CCC employees, if you
have doubts. Another $30 million could've saved the company, i.e. the
cost of one sale. This is a sad way for a company to die, but it has
nothing to do with the quality of the product.
Lucid also died because of a business gamble. Perhaps they should've
tried the data-mining market, instead.
All I'll say about Erik's attitude is that he's being well and truely
provoked. Nobody needs an attitude problem to react strongly to your
argument - not that I recommend anything but sober debate. Insults
won't get us anywhere useful.
--
<URL:http://www.wildcard.demon.co.uk/> You can never browse enough
Martin Rodgers | Programmer and Information Broker | London, UK
Please note: my email address is gubbish.
------------------------------
Date: Wed, 23 Apr 1997 18:32:57 -0600
From: William Clodius <wclodius@lanl.gov>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <335EAA39.ABD@lanl.gov>
David Hanley wrote:
>
> <snip>
>
> Ok, so you found one example on one CPU. Great. Do you have any
> others?
> Because when you say 'cpu's XXX' it means that most or all cpu's have
> that
> feature. But there's more..
Learn your grammar. cpu's is the singular posesive. To prove his point
all he has to do is give one example. It is a bit much to ask him to
give examples for a majority of the CPU's available on the market.
>
> >
> > C is _not_ the be-all, end-all of programming languages and C is _not_ the
> > universal assembler that some would like it to be. that you cannot even
> > put this instruction to use without a lot of prior work that you also have
> > a hard time doing in C, shows that the SPARC designers thought of more than
> > increasingly myopic C crowd.
>
> I would think it's better to be myopic than to have your eyes shut.
> The fact is, most newer chips are not designed for lisp at all. The
> basic
> operations certianly are not based on type.
>
He did not claim that CPU's were designed for Lisp. He claimed that they
were not exclusively designed for C. I would not be surprised to find
that there are instructions that Cobol or Ada, but not C, could use, or
instructions that an OS could use which has no C equivalent. And he did
not claim that any additional instructions that other languages might
use, and C could not use, involved types, other things could involve
garbage collecting, certain forms of exception handling, etc.
As a side point, does anyone know if the newer "Java" chips have
instructions that check types?
> <snip>
--
William B. Clodius Phone: (505)-665-9370
Los Alamos Nat. Lab., NIS-2 FAX: (505)-667-3815
PO Box 1663, MS-C323 Group office: (505)-667-5776
Los Alamos, NM 87545 Email: wclodius@lanl.gov
------------------------------
Date: 24 Apr 1997 12:37:01 +0200
From: Matthias Neeracher <neeri@iis.ee.ethz.ch>
Subject: Re: Mac version of Perl ...
Message-Id: <86rag0g10y.fsf@iis.ee.ethz.ch>
rwvr90@email.sps.mot.com (Richard Petty) writes:
> In article <5j5sjo$nil@bmerhc5e.bnr.ca>, brodger@bnr.ca (Roger
> Balakrishnan ) wrote:
> >Where (FTP sites etc) can I get a Mac version
> >of perl.
Try CPAN.
> >BTW I am using a Mac SE, I dont think its using
> >system 7 (Its been so long since Ive powered it
> >up !!!)
In that case, the only version that will run is "MacPerl Runtime" from the
MacPerl 4 package. I do recall testing it a bit on an 1M Mac Plus, but I'm not
sure if all versions will run. I'm pretty sure 4.1.3 did, not sure about 4.1.8.
Contact me if the version you've tried doesn't work.
> I think I have bad news for you, though. You own a large paperweight.
>
> I'm not intimately familiar with MacPerl but I'm positive the most recent
> version is a no-go for you. And even if it is, Perl programming implies
> you've got some Perl processing in mind and an SE runs at less than 10%
> the speed of the cheapest currently shipping Mac/clone.
This is all true, but even on an SE, MacPerl should manage to get quite serious
text mangling done in reasonable time.
Matthias
-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri
"Larry Wall got us 15kg of cyclonite. We're waiting for the final go-ahead
then we'll blow them all to hell."
-- (Presumably random) .sig generated by the Berkeley anonymous remailer.
------------------------------
Date: 24 Apr 1997 10:17:01 GMT
From: junkmail@abdn.ac.uk (Kyzer)
Subject: Re: No syntax errors, but still the thing won't run
Message-Id: <5jnbut$8l5@info.abdn.ac.uk>
Kevin Cotter of rant@lp-llc.com wrote in comp.lang.perl.misc:
: I wanted to apoligize to Tom for my remarks earlier.
Hey, you asshole, he's an asshole :) :) :) :) :) :) (etc...)
: I have become very frustrated over my script. Did I post irrationally -
: based on the response I'm getting from the group - YES. So I am sorry.
Don't worry, that happens to all of us. It's much better you posted and
heard the advice of many other people, than struggle by yourself, some might
say 'digging yourself deeper'. OK, it's not the "best" question to ask, and
not the "best" newsgroup to post the question to, but does this really annoy
anyone other than the long-standing elders?
: At the time I sent it, I felt I was being talked down to. The "In your
: attempt to reinvent the wheel, you seem to have gotten a flat tire. :-)"
: comment really got my goat.
Well, usually with smileys you're speaking as a colleague, not a lecturer :-)
: In closing, If I ever again have a script, that a -w shows no syntax
: errors yet I still get an error 500 when running from the web, what
: would be the best step for me to take in solving this problem.
AFAIN, that error only happens 500 happens if the CGI program returns non-zero
as a result code to the web-server executing it. That's either
a) the perl program itself
b) the wrapper that runs it, or
c) none of the above.
Make sure you exit all your perl programs with exit 0; or just let them run
to their natural conclusion. If you DIE it's a 500 response for sure.
If that doesn't help, ask your system admin for information on the matter.
If they let you run CGI then they should at least tell you how they've
configured it.
: On my knees in search of forgiveness,
Praise [IYFGH], not mortals :)
: Kevin Cotter
--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com |University or AUCC, thankfully.***** |always!
Britcode(v1.1): Brit(S) H+++: U+++: a18 s+:- hf++>+++ b+ m+ x? X---:+
P-- S+++ M++ R-- A C-- T--- TV+ Ci MuI+ MuR++ MuJ--- Am+++ Ac+ B+ V---
------------------------------
Date: Thu, 24 Apr 1997 10:17:08 +0200
From: Luca Passani <lpa@sysdeco.no>
To: Eryq <eryq@enteract.com>
Subject: Re: Perl as its own metalanguage?
Message-Id: <335F1704.7776@sysdeco.no>
[posted and mailed]
Eryq wrote:
> Second: Prolog is an excellent languange for implementing expert-systems, and
> there are many expert-systems applications out there which you might
> not be aware of. The most common seem to be "diagnostic assistant" tools...
> I've heard of the operational use of:
>
> * a medical diagnosis application, intended as a teaching tool I think.
>
> * a system for assisting physicians in the prescribing of
> several drugs to a patient w.r.t. avoiding dangerous interactions
> and allergic reactions, and also usable by pharmacists.
>
> * a system which assists chemists in the reading of spectroscopic
> analyses to determine the composition and structure of an unknown
> molecule.
I used Prolog too (with a wonderful graphical package called XPCE, by
the way), and even though I felt confortable with it after overcoming
the learning curve, my impression has always been that you can't really
put a limit to how your process will grow depending on the data it has
to manipulate. They say that one they computers will be so powerful that
this will not be an issue anymore, but I'm not convinced.
The real argument for Prolog and functional languages has always been
the supposed possibility to demonstrate formal properties of programs or
even build programs automatically starting for some formal problem
specification. I don't think that any of these results has been achieved
for applications larger than 10 lines of code.
Logic programming is the wrong answer, the right one is called
Object-Orientation: do whatever kind of dirty acts your immagination can
think of in your objects, but provide a clean interface to the others.
Once it works, it will work for good.
>
> Nowadays, with people embedding language-interpreter code in their C applications,
> you can't just look at a system running on a PC and say "that doesn't use Prolog
> or CLIPS or Perl or XXX". You might be surprised at what's really going on
> behind the scenes.
This is true, but if you think in terms of development time,
maintenability and efficiency for arbitrary input data things are
different.
> There is little wisdom in arguing the virtues of a screwdriver over
> a hammer. The right tool for the right job.
Here we are discussing the virtue of a screwdriver against a whole box
of tools. :-)
Luca
======================================================================
Luca Passani. | Sysdeco Innovation AS, http://www.sysdeco.no
Email: lpa@sysdeco.no | Trondheimsveien 184, 0570 Oslo, Norway
Tel: (+47) 22 09 66 06 | Fax: (+47) 22 09 65 03
======================================================================
------------------------------
Date: 24 Apr 1997 10:45:10 GMT
From: junkmail@sysc.abdn.ac.uk (Kyzer)
Subject: Re: PERL Editor
Message-Id: <5jndjm$co5@info.abdn.ac.uk>
Chris King, while smelling of fish, wrote:
: In article <s39bj5.be9.ln@localhost>, Tad McClellan <tadmc@flash.net>
: writes
: >Perl != CGI
: Surely you mean 'perl' ne 'CGI' ? :-)
s/Perl/CGI/ as Perl was only created to do CGI scripts faster than csh, you
couldn't do this, for example:
while(<>){s/\cM\n/\n/g;print;} # dos2unix
while(<>){tr/a-zA-Z/n-za-mN-ZA-M/;print;} # rot13
#!/bin/perl
# mates
# actually formatted (even tho formatting can waste over 50% of a printout -
# just remove all unneccesary spaces, that's what I say)
if (!(open(MATES,"<$ENV{'HOME'}/.matesrc"))) {
print "No .matesrc file.\n"; exit;
}
chop(@mates=<MATES>); close(MATES); # who's your mates
chop(@who=`who -us`); # who's online here
chop($me=`whoami`); # who you are
$mc=0; $iamon=0;
foreach (@who) {
if (/(\S*)\s*.*\((\S*)\)/) {
$mate=$1; $addr=$2;
foreach (@mates) {
($login, $name)=split("=");
if ($login eq $mate) {
print "$name ($login) is on from $addr\n"; $mc++;
if ($me eq $login) { $iamon=1; }
}
}
}
}
# number of mates online
if ($mc==0) {
print "No mates online.\n";
}
if ($mc==1) { print "1 mate online";
if ($iamon == 1) {
print " (and it's YOU!)\n";
}
else {
print ".\n";
}
}
if ($mc>=2) {
print "$mc mates online";
if ($iamon == 1) {
print " (one of whom is you)\n";
}
else {
print ".\n";
}
}
--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com |University or AUCC, thankfully.***** |always!
My other sig is a Ford Fiesta
------------------------------
Date: Thu, 24 Apr 1997 09:19:06 +0100
From: iqbal gandham <igandham@prestel.net>
Subject: Re: switch and if
Message-Id: <335F177A.7BAF@prestel.net>
Chipmunk wrote:
>
> In article <335E3B6E.39D8@prestel.net>
> iqbal gandham <igandham@prestel.net> writes:
>
> > Is it better to use an if statement or switch, or doesn't it make much
> > difference.
> >
> > I have about eight if else statemants.
> >
> > As far as I know if you use if statements then it checks through every
> > statement, whereis using the switch method you can fall out of the block
> > when say the pattern is met.
>
> You are absolutely right about that. There is no reason to use
> multiple if/else statements like that in Perl, when Perl's switch
> statement will do the same thing much more efficiently.
>
> Chipmunk
Yes but that was just a thought, I need to know if it really is more
effecient. The if and elsif statements also fall out when the "pattern"
is matched, just as the switch statement does.
Iqbal
------------------------------
Date: Thu, 24 Apr 1997 11:29:55 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: switch and if
Message-Id: <335F3623.20BF@unl.ac.uk>
iqbal gandham wrote:
> Chipmunk wrote:
> > In article <335E3B6E.39D8@prestel.net>
> > iqbal gandham <igandham@prestel.net> writes:
> >
> > > Is it better to use an if statement or switch, or doesn't it make much
> > > difference.
> > You are absolutely right about that. There is no reason to use
> > multiple if/else statements like that in Perl, when Perl's switch
> > statement will do the same thing much more efficiently.
> >
Ok - confused now. I thought, as Abigail said, that there was no
switch/case statement in perl and
that effective switch/case statements coud be written using
if/elsif/else constructs.
I think Chipmunk is wrong here .. or amd I?
Alastair.
------------------------------
Date: Thu, 24 Apr 1997 11:31:48 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: sysopen object method in perl 5.001?
Message-Id: <335F3694.A39@unl.ac.uk>
Eryq wrote:
>
> Edward Henigin wrote:
>
> > Give us a f*cking working flock() for solaris and we'll stop
> > using file existance.
>
> I believe 5.004 does a proper emulation of flock(), using fcntl().
>
> Actually, you probably always had the option of one when you
> built Perl: just be sure to link in with whatever BSD libraries
> Solaris provides, and make sure Perl can find it so it doesn't
> attempt the (faulty|impossible) emulation of flock() with lockf().
the bsd compatible libraries are in /usr/ucb and have been seriously
unreliable from solaris 2.2 - 2.5.
Not recommended to even go near them.
Alastair.
------------------------------
Date: 24 Apr 1997 10:47:37 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: sysopen object method in perl 5.001?
Message-Id: <5jndo9$8ln$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
[ the address Edward Henigin <ed@texas.net> has been added to
all spam lists ]
In comp.lang.perl.misc, Edward Henigin <ed@texas.net_nospam> writes:
: Give us a f*cking working flock() for solaris and we'll stop
:using file existance.
Build perl with the ucb library, or just get a newer version of
flock.
: it works. it works by design, it's guaranteed to work.
*NO THE DOCUMENTATION LIES* if you're over nfs.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
There are many times when you want it to ignore the rest of the string just
like atof() does. Oddly enough, Perl calls atof(). How convenient. :-)
--Larry Wall in <1991Jun24.231628.14446@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: 24 Apr 1997 10:10:59 GMT
From: "Santiago Alvarez Rojo" <santiago@gambito.com>
Subject: Re: www-based e-mail
Message-Id: <01bc5097$71b803a0$7131a8c0@sg059pcs>
Hi Greg,
If a user don't have an email account, he will never receive email. This is
quite trivial, isn't it?
However, there are a few sites in the web providing free email. Two of them
are:
http://www.hotmail.com
http://www.geocities.com
any of them allow you pop3.
Hope this helps.
Santiago
-----------------------------------------------------------------
Santiago Alvarez Rojo
santiago@gambito.com
http://www.gambito.com/santiago
PGP-key: http://gambito.com/santiago/pgp.txt
-----------------------------------------------------------------
Greg <greg@skokie.com> escribis en artmculo <335E73B9.412B@skokie.com>...
> did you guys see the www.usa.net page or hotmail.com?
>
> i want to put that www-based e-mail on my server... i did couple of
> pages all non-profit, and i would like my visitors to communicate with
> me somehow, but some of them don't have e-mail accounts (well, yes, they
> can send me e-mail but i can't reply to it ;-) )
>
> do you know of any location on the web, or do you have a script that
> does that? if not, do you have any suggestions on how to write one? i'm
> sort of a beginner in perl ;-)
>
> thank you for your help!
>
> greg
>
> --
> Greg --- WebMaster ---
> __ __ _ _ _ WebTech Designers
> / / /\ \ \___| |__ | |_ ___ ___| |__
> --------------------------------
> \ \/ \/ / _ \ '_ \| __/ _ \/ __| '_ \ | Pager/Voice : (312)295-3426
> |
> \ /\ / __/ |_) | || __/ (__| | | | | e-mail: greg@skokie.com
> |
> \/ \/ \___|_.__/ \__\___|\___|_| |_| | http://www.skokie.com/greg
> |
> -------------------------------------------------------------------------
>
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 361
*************************************