[9002] in Perl-Users-Digest
Perl-Users Digest, Issue: 2620 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 16 22:07:17 1998
Date: Sat, 16 May 98 19:00:24 -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 Sat, 16 May 1998 Volume: 8 Number: 2620
Today's topics:
[5.004] Running a perl script using sh (Paul D. Smith)
CGI editors for windows <a_klein@ix.netcom.com>
Does a script run slow if it is 100 to 200K big? <a_klein@ix.netcom.com>
Re: Does Perl have a IDE?I don't like command line. (Chip Salzenberg)
Re: Does Perl have a IDE?I don't like command line. (Stuart McDow)
Re: Does Perl have a IDE?I don't like command line. <birgitt@order.booktraders.com>
Re: Does Perl have a IDE?I don't like command line. (Abigail)
Re: Does Perl have a IDE?I don't like command line. fsg@ultranet.com
form data <jlampard@quakerstate.com>
Re: form data <webmaster@fccjmail.fccj.org>
Re: form data <jlampard@quakerstate.com>
Re: How to generate random passwords? <scribble@pobox.com>
Re: IF problems.... <kenner@xnet.com>
Need help from MacPerl expert! (Alex Dong Li)
NEWBIE: simulating load? <clay@crawlspace.com>
Re: Perl for Non-programmers (Chip Salzenberg)
Tip: -0 commandline switch <gnat@frii.com>
uniq in perl (tony)
Re: uniq in perl (Mike Stok)
Re: uniq in perl (Chris Benson)
what's up with comp.lang.perl.moderated proposal <rdh@best.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 May 1998 16:22:06 -0400
From: psmith@baynetworks.com (Paul D. Smith)
Subject: [5.004] Running a perl script using sh
Message-Id: <p5pvhenez5.fsf@baynetworks.com>
OK, so I have a perl script. But I don't know where perl will actually
be located on the system running the script. I want to make the script
"self-starting".
So, I look in the docs and it says I can use this oh-so-clever bit:
#!/bin/sh # perl
eval 'exec perl -S $0 ${1:"$@"}'
if 0;
So, fine. That seems to work... on most systems. However, on some
systems sh doesn't like the "# perl" on the end of the first line, such
as OSF (where the interpreter line can be >32 chars long, I guess).
So, I tried adding "--" as suggested by the docs:
#!/bin/sh -- # perl
eval 'exec perl -S $0 ${1:"$@"}'
if 0;
That works on OSF and others, but doesn't work everywhere: for example,
bash doesn't seem to accept -- as a valid shell option on an interpreter
line, so on any system where bash is being used as /bin/sh the above
script won't work.
So, I decide to just take "# perl" out of there altogether:
#!/bin/sh
eval 'exec perl -S $0 ${1:"$@"}'
if 0;
Now, of course, the silly thing goes into an infinite loop, because of
this bit from the docs:
If the #! line does not contain the word "perl", the program named
after the #! is executed instead of the Perl interpreter. This is
slightly bizarre, but it helps people on machines that don't do #!,
because they can tell a program that their SHELL is /usr/bin/perl,
and Perl will then dispatch the program to the correct interpreter
for them.
So, the only way I was actually able to get this working reliably on all
my systems was this:
#!/bin/sh
#! perl
eval 'exec perl -x -S $0 ${1:"$@"}'
if 0;
Or, if you're an Emacs user, this works well:
#!/bin/sh
#! -*-perl-*-
eval 'exec perl -x -S $0 ${1:"$@"}'
if 0;
So far, this seems to work correctly for me on all the above types of
systems. Just thought someone else might find this useful... or am I
missing something obvious?
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@baynetworks.com> Network Management Development
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions--Bay Networks takes no responsibility for them.
------------------------------
Date: Sat, 16 May 1998 18:26:43 -0700
From: "Adam Klein" <a_klein@ix.netcom.com>
Subject: CGI editors for windows
Message-Id: <6jlegk$66p$1@dfw-ixnews11.ix.netcom.com>
Is there any good editors for writing CGI in windows. Something that easily
organizes all the subs like a visual basic interface? I am really
frustrated with programming in notepad.
Thanx,
Adam
------------------------------
Date: Sat, 16 May 1998 18:05:45 -0700
From: "Adam Klein" <a_klein@ix.netcom.com>
Subject: Does a script run slow if it is 100 to 200K big?
Message-Id: <6jld95$hvg@sjx-ixn8.ix.netcom.com>
I am making an advanced CGI script. I was just wondering wheather or not
the script runs slow if it is about 100 to 200K big? Is there an
alternative to this? Should I make a whole bunch of scripts have them call
each other? I'd like to keep everything under one file.
Adam
------------------------------
Date: Sat, 16 May 1998 20:08:22 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jkrqm$1k9$1@cyprus.atlantic.net>
In <6jiicl$d0$1@ultranet.com> fsg@ultranet.com writes:
> This [...free softwhere generating the best softwhere...] is a great
>idea, but is a crock. For instance, Perl does not have a usable graphical
>user interface library.
Well, first we'd have to agree on defining "best". Apparently we don't.
Second, we'd have to look at the source code and relative bug
detection and bug fix records of free vs. commercial software.
In large part, those data are not available. So we have to guess
and work on anecdote. My personal anecdotes are mostly to the
effect that commercial software development is seriously scary in
its atrocious and inexcusable badness.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 16 May 1998 20:05:14 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jkrhq$75b$1@ns1.arlut.utexas.edu>
Lloyd Zusman <ljz@asfast.com> writes:
>
> But a significant piece of the money being spent by the big
> corporations I'm familiar with is going towards Microsoft solutions,
> and this money is pushing the industry in certain directions.
Which underscores the point that the direction the computer industry
is taking will emphasize marketing over sound engineering. It's
already happening. Which is reason #1 why I'm looking into gradutate
programs with an eye on changing careers. (well, maybe not #1, but in
the top 5 for sure.)
> And even more unfortunate is the fact that Unices will probably have
> to start emulating the Windows look-and-feel...
It would hard to take such a machine seriously.
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"Look for beauty in roughness, unpolishedness"
------------------------------
Date: Sat, 16 May 1998 20:18:05 -0400
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <355E2CBD.2EBCEB02@order.booktraders.com>
Lloyd Zusman wrote:
>
> Tom Christiansen <tchrist@mox.perl.com> writes:
>
> > In comp.lang.perl.misc, fsg@ultranet.com writes:
> > :This is a USENET problem, not a Perl problem, and it won't cause the
> > :downfall of Perl.
> >
> > That wasn't the point. The point was that this kind of thing has made
> > this newsgroup virtually useless, practically destroying through a
> > forever-September combination of ignorance and selfishness a resource
> > that had been historically valuable to the Perl community. Now combine
> > this with the effective disregard -- and sometimes even scorn -- for
> > the man-decades of work we've all spent documenting Perl. [ ... ]
Now, it is nothing new that if humans are allowed to get away
with something, they most probably will try to do.
Questions are asked without reading the docs first, because they
are allowed to. Should they ? Yes. Should they for free ? No.
Are you afraid to consumerize the ideals of a c.l.p.m. ?
I am too new to this, but I don't see why offering open and free
source code, free documentation, freely available, downloadable,
readable, anywhere in the world, is not enough of a good thing.
We have good books, decently priced, we are basically very
spoiled with free everything.
Someone said here a couple of days ago, he wanted to know if
someone could point to any other better thing than CPAN,
commercially or for free anywhere ? He didn't get an answer,
I wonder why ? May be there isn't ?
I am humble, as I am new, may be I am completely naive and
certainly completely unknowledgable, (so flame me
- I really don't care), but it seems to me that
possibly one day
a. Non-Open-Source code might become illegal, because
programs will be so complex and society too dependent
and victimized that code needs to be open to
give anyone of the world community a chance to
"hack/check/smack" it to have control over it.
b. Linux, Perl and all following open source programs and
applications will outweigh any commercial software with
non-open-source code.
I would wish that this would happen.
I also would wish that the community of Perl developers,
Linux developers and real software engineers and developers
wouldn't be so shy and make clear, that one might fight for freely
available Open Source code, but not for free programming
support.
It needs to be supported somehow, it doesn't have to be
commercial or profit-making.
>
> I think that this scorn you are referring to occurs very infrequently.
> I believe that the vast majority of people who have more than a
> passing familiarity with Perl are *very* appreciative of the work that
> has gone into the language, the documentation, the module library,
> etc. Furthermore, I also believe that most of the people who
> appreciate these things are also benefitting greatly from them and
> are gratefully aware of this fact.
>
Yes, but I think that's not enough.
Why is this such an "unthinkable" thing ?
People like ... well all of you who deserve it, you know who they
are... should get paid for what they have done as volunteers so far
for c.p.l.m.
It has been argued that when two newsgroups .misc and moderated
would exist, the blind will flock with the experts. Sure they
would that's why they came here in the first place.
Why would it be so outrageous to ask any "poster" to c.p.l.m,
(not reader) to subscribe and pay a *very* small
yearly subscription fee to support the maintainers of the
documentation and the monitoring, answering experts of this list.
It's still a lousy job, even if you get paid, it doesn't mean
in any way that it is "commercial", nobody makes a profit, but
noone's dedication should be further taken advantage of either.
I mean people pay a couple of dimes to "Public Television" or
the "Library of Congress" to support a good, free, uncommercial
cause. Isn't that comparable ?
> > [ ... ] Why should we care to be part of that world? Why should Perl?
Perl can't hide anymore, and if you tried to hide it, you would get
reeeeaaaally in trouble..... 8-).
> better place. Countless millions of person-hours have been saved
> through the use of Perl. Millions of bursts of joyful glee have
> lovingly bubbled out of the hearts of countless Perl programmers as
> they have delighted in discovering yet another really *COOL* language
> feature that only a true hacker/geek/wizard can appreciate in the
> depths of his or her soul.
See, what did I say ? You think they would let you go ?
>
> If you're getting burned out or need a rest, then be all means, do
> what you need to do for yourself. If that means leaving this world
> for a while, or perhaps just hanging out in a place like
> clp.moderated, then go for it. Most people here will support you and
> silently (or not-so-silently) pray for your return.
>
I would give a couple of dollars of my dimes to c.p.l.m, if you
all would stay....
> But whatever you do, don't take Perl with you!
>
Can he do that ?
Birgitt Funk
------------------------------
Date: 17 May 1998 01:23:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jle6q$bjp$1@client3.news.psi.net>
Stuart McDow (smcdow@arlut.utexas.edu) wrote on MDCCXIX September
MCMXCIII in <URL: news:6jk5o2$85g$1@ns1.arlut.utexas.edu>:
++ abigail@fnx.com (Abigail) writes:
++ >
++ > gcc is hardly native to SunOS, is it? Besides, how do you build gcc
++ > without a compiler?
++
++ Well, for that matter, there isn't a native compiler for NT,
++ either. The playing field is level in that regard.
Well, yeah, that was what started this subthread. I merely pointed
out that NT was not unique in that respect.
++ But at least SunOS
++ is an open system (for the most part) and has well-known behavior (for
++ the most part). As for building gcc, I downloaded a pre-built gcc from
++ somewhere (sunsite, maybe?), and used that to build gcc. Simple, no?
And there isn't a gcc port for NT yet?
++ > Really? A recent thread on p5p claimed that IRIX doesn't come with
++ > include files.
++
++ Hmm, I can't speak to that directly. My dim memory is that, for IRIX 5
++ as least, the include files were included on the distribution cdrom,
++ but not installed by default. Would someone like to run 'inst' against
++ an IRIX distribution cdrom to verify that?
++
++
++ > Perhaps you have to pay twice, but you should look at the total
++ > cost. How much does NT + SDKs costs compared say Solaris +
++ > compiler.
++
++ Well, if we're going to talk about cost, we must also talk about cost
++ of machine maintenance as well. There is plenty of evidence to show
++ that a medium to large network (>250 machines) of NT machines is much
++ more expensive to maintain than a network of Unix machines. Well,
++ certian Unix machines anyway. :-). And there is a lot of anecdotal
++ evidence to suggest that this also holds true from smaller networks.
If that's true, why are so many places converting to NT? Surely some
places just go for the sales talk, but won't you think many places
have the competence to do a cost analysis?
++ http://www.kirch.net/unix-nt.html has a good analysis of this.
++
++ But on plain old cost issues alone, my OS plus compiler cost
++ $99. total. The lower bound of total cost for Linux with compiler is
++ $0, and may reach as high as $50.
Ah, yeah, Linux. The classical answer to Windows. I'm sorry, Linux is a
nice OS, but many things that are available for NT or commercial Unices
aren't available for Linux. There's no Sybase for Linux, or Oracle,
or X-runner, or a lot of other (commercial) packages.
++ But that really wasn't my point. The irritating thing is that with NT,
++ there is no *choice* in the matter. Under most Unixes, one can buy a
++ proprietary compiler from the OS vendor or somebody else. Or not. With
++ NT, that choice is taken away. And because it's a closed system, there
++ are no free alternatives. I suggest that supression of free
++ alternative compilers and SDKs (and even general "productivity tools")
++ is the very reason that NT was designed to be a closed system.
If Unix is all that wonderful, and NT so bad, then why worry about NT?
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 16 May 1998 21:42:52 -0400
From: fsg@ultranet.com
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jlfas$234$1@ultranet.com>
Tom writes:
>In comp.lang.perl.misc,
> fsg@ultranet.com writes:
>:I'm not defending win32 (or even seriously trying to sell you a TSIAB,
>:even though as I said, unreservedly, though I hate win32, TSIAB is a
>:world class solution), but it's important to note that solutions exist.
>But fleeceware only, if that, just like everything else in that world.
This isn't one of those things where you want everyone else's stuff
to be free, but you want to make money off teaching, is it? That
would be kinda sad.
Felix
------------------------------
Date: 16 May 1998 21:37:15 GMT
From: "JD Lampard" <jlampard@quakerstate.com>
Subject: form data
Message-Id: <01bd8113$021479e0$45e5ced0@jlampard.quakerstate.com>
first off, let me say that i'm very new to Perl. however, i've been doing
much reading including Programming Perl by Larry Wass and Randal L.
Schwartz. my goal is very simple, but i'm having difficulty reaching it.
i have a form (on a web page), and when it's submitted i want the data to
be extracted and placed into a text file. i've found many scripts which do
this and more, but when i strip out what i don't want it no longer works.
i've tried writing my own, but i get Server 500 errors... more specifically
the message says the that CGI has "empty output". occasionally, after some
editing, the error reads that there is no space between the header info and
the data.
ideas, suggestions, help...
very much appreciated,
JD Lampard
lampard at ticnet.com
<><><><><><><><><><><><><>
------------------------------
Date: Sat, 16 May 1998 22:41:41 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: form data
Message-Id: <355E144B.818FE2E6@fccjmail.fccj.org>
JD Lampard wrote:
>
> Larry Wass
That should be Larry Wall :-)
> CGI has "empty output".
With the above error you are probably closer than you think.
Are you using CGI.pm; if not get it and read up on it.
-Sneex-
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster
------------------------------
Date: 17 May 1998 00:12:09 GMT
From: "JD Lampard" <jlampard@quakerstate.com>
Subject: Re: form data
Message-Id: <01bd8128$a38acee0$45e5ced0@jlampard.quakerstate.com>
Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org> wrote in article
<355E144B.818FE2E6@fccjmail.fccj.org>...
> JD Lampard wrote:
> >
> > Larry Wass
>
> That should be Larry Wall :-)
so sorry wise guy! Larry WALL, i'm sorry for the typo in your name--right
finger wrong hand.
>
>
> > CGI has "empty output".
>
> With the above error you are probably closer than you think.
> Are you using CGI.pm; if not get it and read up on it.
i figured that much out on my own!
>
> -Sneex-
>
____________________________________________________________________________
> Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
> Florida Community College at Jacksonville | 501 W. State St. | Jax, FL
32202
> mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster
>
------------------------------
Date: 16 May 1998 17:03:10 -0500
From: Tushar Samant <scribble@pobox.com>
Subject: Re: How to generate random passwords?
Message-Id: <6jl2eu$sv1@tekka.wwa.com>
due@murray.fordham.edu writes:
>In article <comdog-ya02408000R1505981344240001@news.panix.com>, brian d
>foy (comdog@computerdog.com) posted...
>
>[snip, although I hate to]
>
> That is just so much nicer than my way. The while here seems much
>more esthetically pleasing than the for. One of the things I love about
>Perl is that code can be written in a utilitarian way but also in an
>elegant way. Perl just seems to lend itself to elegant expression. One
>of the things I enjoy about this newsgroup is reading the elegant code and
>hopefully learning to speak in a more refined manner. Thanks for the
>examples folks! Keep them coming.
Frankly, I think that yours is more "elegant". It takes 8 steps to
come up with 8 letters, no more, no less. That's better than standing
at a roulette wheel and praying for the right numbers to come up. I
understand that it will WORK, and you will be through in, what, twice
as much time, and there is no statistical requirement on the words
produced, etc etc... Still, it is clumsy. If you are impressed by
the relative absence of line noise, then reduce the line noise in
yours.
------------------------------
Date: Sat, 16 May 1998 16:36:36 -0500
From: "Kenner Estes" <kenner@xnet.com>
Subject: Re: IF problems....
Message-Id: <6jl0u4$3hb$1@flood.xnet.com>
As a syntax note, the script that you included has the following:
> $URL1[Counter]=$Match;
Don't forget the "$" that goes in front of "Counter" in the brackets.
Should read:
$URL1[$Counter]=$Match;
Also, upper- and lower-case makes a difference in variable names - be sure
to use "$Match" or "$match" consistently all the way through.
These are probably just mistakes made when retyping the script, but, if not,
this might help.
Good luck!
------------------------------
Date: Sun, 17 May 1998 02:53:14 GMT
From: ali@genet.sickkids.on.ca (Alex Dong Li)
Subject: Need help from MacPerl expert!
Message-Id: <6jl8p7$9s7$1@resunix.sickkids.on.ca>
Date: Sat, 16 May 1998 19:30:41 -0400 (EDT)
From: "Dong Li (Alex)" <ali@genet.sickkids.on.ca>
To: Alex Dong Li <ali@genet.sickkids.on.ca>
Subject: Forwarded mail....
Message-ID:
<Pine.A32.3.91.980516193032.27947A-100000@viola.genet.sickkids.on.ca>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Status: O
Dear MacPerl experts, especially experts internet connection,
I am trying to modify a unix/winNT version of web GET subroutine,
which acts like a GET client, so that I can use it on Mac.
When I tried the following script on Mac, I got the following message:
"Cannot bind. No enough space"
Could anyone tell me why? And also are "$AF_INET = 1" and
"$SOCK_STREAM =1" correct for Mac?
Thanks in advance.
Alex
-------------------------
#!/usr/local/bin/perl -w
$AF_INET =1;
$SOCK_STREAM = 1;
$hostname = "tcp";
## a sample:
&GetIt("http://www.uic.edu/~lidong/gif/h1big.gif", "test.gif");
sub GetIt {
local($url, $outputFilename) = @_;
local($name,$aliases,$proto,$len,$type);
local($this, $that, $thisaddr, $thataddr);
local($server,$port,$serverRelativeURL,$getCommand);
## if URL looks like: http://www.univ.edu/blabla
if($url =~ /^([a-z]+)\:\/\/([^:\/]+)(:\d+)?(.+)$/) {
$server = $2;
$port = $3;
$serverRelativeURL = $4;
}
if(!defined($port)) { $port = 80; }
else { $port =~ s/://; }
open(OUTPUT_FOR_GET, ">$outputFilename");
## build the HTTP GET command
$getCommand = "GET $serverRelativeURL HTTP/1.0\015\012\015\012";
$name = $aliases = $proto = '';
($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$port) = getservbyname($port,'tcp') unless $port =~
/^\d+$/;;
($name,$aliases,$type,$len,$thisaddr) = gethostbyname($hostname);
($name,$aliases,$type,$len,$thataddr) = gethostbyname($server);
if($name eq '') { die $!; } # handle gethostbyname failure
## change this to clieent, that to server, print out error msg too!
$this = pack("Sna4x8",$AF_INET,0,$thisaddr);
$that = pack("Sna4x8",$AF_INET,$port,$thataddr);
# make the socket filehandle
if (!socket(SOCKET_FOR_GET,$AF_INET,$SOCK_STREAM,$proto)) { die $!; };
# give the socket an address
if (!bind(SOCKET_FOR_GET,$this)) { print"Cannot bind\n"; die $!; }
#call up the server
if (!connect(SOCKET_FOR_GET,$that)) { die $!; }
# set socket to be command buffered
select(SOCKET_FOR_GET);
$| = 1;
select(STDOUT);
print SOCKET_FOR_GET $getCommand;
$_ = <SOCKET_FOR_GET>;
if(/^HTTP/) {
while(<SOCKET_FOR_GET>) {
# look for first blank line
if(/^\w/) { next; }
else {
while(<SOCKET_FOR_GET>) {
print OUTPUT_FOR_GET $_;
}
}
}
}
close(OUTPUT_FOR_GET);
close(SOCKET_FOR_GET);
}
Email: ali@genet.sickkids.on.ca
URL: http://www.globalserve.net/~lidong/
------------------------------
Date: Sat, 16 May 1998 13:43:18 -0700
From: Clay Loveless <clay@crawlspace.com>
Subject: NEWBIE: simulating load?
Message-Id: <355DFA4C.47B426DA@crawlspace.com>
Hello --
I've got a small script that uses some LWP modules, and I'd like to simulate
running it roughly a zillion times or so to see how it will hold up, server
load, etc.
I think I saw a command in Perl that would do something like this, but I've
gone back to the Camel book looking for it and can't find it.
Anyone know of a command that'll do this?
Thanks,
Clay Loveless
clay@crawlspace.com
------------------------------
Date: Sat, 16 May 1998 20:10:08 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: Perl for Non-programmers
Message-Id: <6jkru0$1kt$1@cyprus.atlantic.net>
According to abigail@fnx.com:
>Chip Salzenberg (chip@mail.atlantic.net) wrote on MDCCXVIII September
>MCMXCIII in <URL: news:6jie16$i1$1@cyprus.atlantic.net>:
>++ The most important skills for a programmer are memory and typing.
>
>You mean that secretaries are perfect as programmers?
Abigail, you're clever. But your selective quotation in this case and
in other cases on p5p cannot possibly be taken as anything but a
malicious attempt to misrepresent my position, making me look bad, and
you good in contrast.
Expect no further discussion on anything not specifically technical.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 16 May 1998 18:03:29 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Tip: -0 commandline switch
Message-Id: <5qiun5ahm6.fsf_-_@prometheus.frii.com>
It's a small thing, but it's fun. You can use the -0 option to
specify on the commandline a replacement value for $/, the input
record separator. The format of the switch is -0ooo where ooo is the
octal value for the character to use.
This isn't PHENOMENALLY useful, I'll be the first to admit. So, I can
read a file as a set of period-terminated chunks. Big honking deal.
More useful are the special values -0777 and -00. The former
specifies a character that doesn't exist as the separator, causing <>
to return the entire file. This is like setting $/ to undef:
% perl -0777 -ne 'print scalar reverse' file1 file2
This reverses the bytes in the files file1 and file2, one file at
a time.
-00 is like setting $/ to "", and reads the file a paragraph at a
time. The difference between setting $/ to "" and setting $/ to
"\n\n" is that "" treats two or more blank lines as a single paragraph
terminator, while "\n\n" will give you empty paragraphs if you have
more than two consecutive blank lines in your file. You can't set
$/ to "\n\n" from the commandline, because you can only specify single
characters in octal with -0. But you rarely want to, anyway.
perl -00 -pe 'print scalar reverse' file1 file2
This reverses the bytes in each paragraph of each file.
Here I'm using the -p flag which assumes a while(<>) loop around
your code, and prints $_ after your code is done with it. -p is
your friend. Have you accepted -p as your personal saviour?
-00 is REALLY useful when your buttheaded paragraph filter or
paragraph translator (e.g., pod filters) tell you that you have bogus
input on "chunk 43". What good is that to man or beast?
perl -00 -ne 'print if $. == 43' chap01.pod
Aaaaah.
Nat
------------------------------
Date: Sat, 16 May 1998 23:55:27 +1000
From: td@lavalink.com.au (tony)
Subject: uniq in perl
Message-Id: <td-1605982355270001@mtterror.lavalink.com.au>
Hi,
I was wondering how to sort a list and output only uniq entries, omitting
any multiples. I know how I'd do it from a shell session using awk, sort
and uniq:
awk -F"\t" '{print $1}' mydatafile.txt | sort |uniq
Could anyone tell me how to do it in perl or which man page (section) to
be looking at?
Cheers
Tony Delov
------------------------------
Date: 16 May 1998 21:23:42 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: uniq in perl
Message-Id: <6jl04u$461@news-central.tiac.net>
In article <td-1605982355270001@mtterror.lavalink.com.au>,
tony <td@lavalink.com.au> wrote:
>Hi,
>I was wondering how to sort a list and output only uniq entries, omitting
>any multiples. I know how I'd do it from a shell session using awk, sort
>and uniq:
>
>awk -F"\t" '{print $1}' mydatafile.txt | sort |uniq
>
>Could anyone tell me how to do it in perl or which man page (section) to
>be looking at?
perlfaq4 in recent systems has an entry "How can I extract just the unique
elements of an array?" so you can use split to get the field you're
interested in. If your data set isn't too big then you might get away
with building the list of fields in memory before scanning it, otherwise
you can loop over the input one line at a time, extracting and examining
the field as you go.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 16 May 1998 23:33:19 +0100
From: chrisb@jesmond.demon.co.uk (Chris Benson)
Subject: Re: uniq in perl
Message-Id: <6jl47f$88g@jesmond.demon.co.uk>
In article <td-1605982355270001@mtterror.lavalink.com.au>,
tony <td@lavalink.com.au> wrote:
>Hi,
>I was wondering how to sort a list and output only uniq entries, omitting
>any multiples. I know how I'd do it from a shell session using awk, sort
>and uniq:
Any mention of uniq(ue) should make you think "hash":
>
>awk -F"\t" '{print $1}' mydatafile.txt | sort |uniq
*one* way:
perl -nae '$seen{$F[0]}++; END {print join "\n", keys %seen}' mydatafile.txt
Differences: splits on whitepace; printed in random order;
>
>Could anyone tell me how to do it in perl or which man page (section) to
>be looking at?
Docs:
perldoc perlrun for the switches and $F[0]
perldoc perlfunc for the print, join, keys ...
perldoc perldata for hashes
Comment:
awk/sort/uniq is less typing: for a one-off I'd (probably) stick with that :)
--
Chris Benson
------------------------------
Date: 16 May 1998 16:11:52 -0700
From: Dale Hagglund <rdh@best.com>
Subject: what's up with comp.lang.perl.moderated proposal
Message-Id: <86iun5bykn.fsf@ponoka.battleriver.com>
I've been off usenet for three weeks, and I notice that no new RFD has
been submitted to news.groups. The current one is now out of date,
and any new RFD will start the process over again.
I hope the effort hasn't been dropped. In spite of some, in my
opinion, fairly minor problems with the original proposal, I'd
definitely like the chance to vote yes on this one.
So what's happening?
Dale.
------------------------------
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 2620
**************************************