[9231] in Perl-Users-Digest
Perl-Users Digest, Issue: 2826 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 10 01:07:23 1998
Date: Tue, 9 Jun 98 22:00:27 -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 Tue, 9 Jun 1998 Volume: 8 Number: 2826
Today's topics:
Re: Altavista, infoseek, etc. (Jon Orwant)
Re: Array Notation...Slices and Elements (Ronald J Kimball)
Re: Array Notation...Slices and Elements <tchrist@mox.perl.com>
Re: Certified Perl Programmers (David Adler)
CFV: comp.lang.perl.moderated moderated (Rebecca McQuitty)
Re: Command line substitution thru subdirectories (Xuming Wang)
Re: Command line substitution thru subdirectories (Xuming Wang)
Re: Command line substitution thru subdirectories <tchrist@mox.perl.com>
Re: Command line substitution thru subdirectories <tchrist@mox.perl.com>
Re: Command line substitution thru subdirectories (Xuming Wang)
Re: efficient comparisons (Charles DeRykus)
Re: efficient comparisons (Ronald J Kimball)
Re: Electronic Fax? (Martien Verbruggen)
Re: filenames between UNIX and win95 (Ronald J Kimball)
Input/criticism/anything? (Chris Reynolds)
Re: McCabe complexity analysis (Michael J Gebis)
Re: McCabe complexity analysis <rra@stanford.edu>
Re: Newbie seeks advice on scripts, cookies and forms. (Jon Orwant)
Re: offline mode? <tchrist@mox.perl.com>
Re: Perl Books? (The Skipster)
Re: Reading a file from the bottom up <rlogsdon@io.com>
Re: Return cell contents to HTML dropdown menu (Jon Orwant)
Re: Stripping HTML coding from CGI data for Perl (Abigail)
Re: Stupid syntax question (Gary M. Greenberg)
Re: Stupid syntax question (Larry Rosler)
Re: Substr (Gary M. Greenberg)
why does this work? abhidon@hotmail.com
Win32: File glob causes floppy to chatter <mburr@halcyon.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Jun 1998 01:54:09 GMT
From: orwant@cyrano.media.mit.edu (Jon Orwant)
To: "arnoud de jong" <arnoud@notenbomer.nl>
Subject: Re: Altavista, infoseek, etc.
Message-Id: <ORWANT.98Jun9215409@cyrano.media.mit.edu>
"arnoud de jong" <arnoud@notenbomer.nl> writes:
Hi,
Does anyone know how I can create a simple search engine. So I can create a
list of URL's and create a searchable index.
Any Ideas?
Try the WWW::Search module, available from
http://www.perl.com/CPAN/modules/by-module/WWW.
-Jon
------------------------------------
Jon Orwant http://tpj.com
Editor & Publisher, The Perl Journal
--
------------------------------
Date: Tue, 9 Jun 1998 23:37:02 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Array Notation...Slices and Elements
Message-Id: <1dadopy.1hes4ze1peh5s0N@bay1-357.quincy.ziplink.net>
Eric Weiss <eweiss@winchendon.com> wrote:
> Does anyone know why it is @array, @array[1,2], but $array[3]?
> OK, @array[3] also works as a slice of 1, but is this any better
> or worse than $array[3]?
@array[3] = localtime;
$array[3] = localtime;
You should only use an array slice when you specifically want an array
slice.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 10 Jun 1998 03:40:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Array Notation...Slices and Elements
Message-Id: <6lkv8a$kvg$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
eweiss@winchendon.com (Eric Weiss) writes:
:Does anyone know why it is @array, @array[1,2], but $array[3]?
:OK, @array[3] also works as a slice of 1, but is this any better
:or worse than $array[3]?
The @ means the return value is a list.
@ARGV
@ARGV[0 .. 2]
@ENV{"HOME", "TERM", "USER"}
They all return lists. They use at signs. A list of one element
is not the same as one element. The listness matters. This is
all in the FAQ. Please consult.
--tom
--
"If ease of use is the highest goal, we should all be driving golf carts."
--Larry Wall
------------------------------
Date: 10 Jun 1998 02:51:09 GMT
From: dha@panix.com (David Adler)
Subject: Re: Certified Perl Programmers
Message-Id: <6lksat$sut@news1.panix.com>
On 9 Jun 1998 19:55:58 GMT, Mike Stok <mike@stok.co.uk> wrote:
>In article <6lk05p$9h3$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>
>>So get certified now, because the more Certified Perl Programmers
>>there are, the more difficult it'll be for someone to set up a company
>>to take your money for certifications. Send mail to
>>mjd-perl-certification@plover.com, and be sure to say what you want to
>>be certified as.
>>
>>I think a preemptive strike could be very effective here.
>
>Are you willing to certify "perl engineers"? I've always wanted to be an
>engineer ;-)
I wanna be a perl druid! */;-%
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
The perversity of the Universe tends towards a maximum.
------------------------------
Date: Wed, 10 Jun 1998 03:17:18 GMT
From: mcq@best.com (Rebecca McQuitty)
Subject: CFV: comp.lang.perl.moderated moderated
Message-Id: <897448637.29761@isc.org>
FIRST CALL FOR VOTES (of 2)
moderated group comp.lang.perl.moderated
Usenet readers may now vote on the proposed worldwide newsgroup
comp.lang.perl.moderated. This CFV contains information about both
the voting process and the proposed group; please read the entire CFV
before voting.
Only the votetaker is authorized to distribute this CFV. Do not post
it to any newsgroup, mail it to any person or mailing list, or place
it on the World Wide Web. Ballots or CFVs provided by anyone except
the votetaker will be invalid.
Newsgroups line:
comp.lang.perl.moderated Perl language. (Moderated)
Votes must be received by 23:59:59 UTC, 1 Jul 1998.
A neutral, third-party volunteer is conducting this vote. Direct
questions about the vote to the votetaker, and questions about the
proposed group to the proponents.
Proponent: Mark-Jason Dominus <mjd-perl-clpmod@plover.com>
Proponent: Chip Salzenberg <chip@perlsupport.com>
Votetaker: Rebecca McQuitty <mcq@best.com>
RATIONALE: comp.lang.perl.moderated
The comp.lang.perl.misc group presently has very high traffic:
typically about 250 articles per day. Much of this traffic is given
over to people asking off-topic questions, and questions answered in
the FAQ.
In these circumstances, a number of regular posters to the group have
stopped reading comp.lang.perl.misc, while new readers can find it
difficult to find relevant posts. The result is reduced usefulness of
the existing comp.lang.perl.misc newsgroup.
This comp.lang.perl.moderated group is proposed as high
signal-to-noise group where readers will not be subjected to the types
of articles described above. The intention is to provide a useful
resource for inexperienced Perl programmers and to attract and retain
experienced programmers who can make a substantial contribution to the
group.
Comp.lang.perl.misc would still be left in place for more general
discussion, and for those topics that no one seems to agree on a place
for.
CHARTER: comp.lang.perl.moderated
The purpose of comp.lang.perl.moderated is to provide a forum for
discussion of matters related to the Perl programming language.
Comp.lang.perl.moderated is a moderated news group for discussion of
common Perl programming issues. Welcomed topics of discussion will
include any topic directly related to the Perl programming language.
The moderators will decide which posts are of general interest to the
worldwide Perl community. The moderators are free to reject any post
which is covered by the comp.lang.perl FAQ(s) or which is more
appropriate to another Usenet discussion group. Obvious homework
problems and trivial questions that can be answered by quick
inspection of the on-line documentation or any Perl text may also be
considered off-topic. Very broad questions which could equally apply
to any computer programming language may also be considered off-topic
by the moderators. Advocacy and "flame wars" about Perl will be
considered off-topic.
Articles should be formatted so as to be easily readable by any Usenet
reader. Badly formatted or munged articles and articles in violation
of the standard principles of netiquette may be rejected by the
moderators.
Overall, the moderators will lean towards accepting articles.
All posters to the group must be registered. Submissions from
registered posters will be forwarded to a moderator, who will post it
to the group if it is appropriate. Inappropriate articles will be
returned to the poster when possible, with an explanation of why the
article was rejected. No attempt will be made to verify the validity
of the poster's address, and bounces will be discarded. If feasible,
some mechanism will be provided for users to post under false
addresses until some better solution to the spamming problem appears.
Articles from first-time posters will be held temporarily. The poster
will be sent registration instructions, the group charter, and
pointers to relevant references. After the poster registers, the held
article will be forwarded to the moderation panel as usual.
No commercial posts of any sort will be allowed in the group.
The moderation panel will always consist of at least six members. New
moderators may be appointed, and old ones removed, by a two-thirds
majority vote of the moderation panel.
Any article submitted by a member of the moderation panel outside the
exercise of his or her administrative role will be subject to the full
moderation procedure described herein.
The moderation panel may implement any technical solutions it
considers necessary to enforce the provisions of this charter.
END CHARTER.
MODERATOR INFO: comp.lang.perl.moderated
Moderator: Russ Allbery <rra@stanford.edu>
Moderator: Greg Bacon <gbacon@cs.uah.edu>
Moderator: Hildo Biersma <hpp@lunatech.com>
Moderator: Mark-Jason Dominus <mjd-clpmod-submissions@plover.com>
Moderator: Eric Eisenhart <eric@sonic.net>
Moderator: "M.J.T. Guy" <mjtg@cus.cam.ac.uk>
Moderator: Tad McClellan <tadmc@metronet.com>
Moderator: Chris Nandor <pudge@pobox.com>
Moderator: "Nathan V. Patwardhan" <nvp@mediaone.net>
Moderator: "Stephen P. Potter" <spp@colltech.com>
Moderator: Stephen Zander <gibreel@pobox.com>
Administrative contact address: mjd-clpm-admin@plover.com
Article submission address: mjd-clpm-submit@plover.com
END MODERATOR INFO.
IMPORTANT VOTING INFORMATION:
The purpose of a Usenet vote is to determine the genuine interest in
reading the proposed group, and soliciting votes from uninterested
parties defeats this purpose. Do *not* distribute this CFV; instead,
direct people to the official CFV posted to news.announce.newgroups.
Distributing pre-marked, incomplete, or otherwise edited copies of
this CFV is considered vote fraud.
This is a public vote: All email addresses, names and votes will be
listed in the final RESULT post. The name used may be either a real
name or an established Usenet handle.
At most one vote is allowed per person or per account. Duplicate
votes will be resolved in favor of the most recent valid vote.
Voters must mail their ballots directly to the votetaker. Anonymous,
forwarded, or proxy votes are not valid, nor are votes mailed from
WWW/HTML/CGI forms (which should not exist). Votes from nonexistent
accounts are also invalid, and the votetaker will reject any "munged"
address she cannot decipher immediately.
Please direct any questions to the votetaker at <mcq@best.com>.
HOW TO VOTE:
Extract the ballot from the CFV by deleting everything before the
"BEGINNING OF BALLOT" and after the "END OF BALLOT" lines. Please do
*not* send the entire CFV back to me. Don't worry about the spacing
of the columns or any quote characters (">") that your software
inserts.
Provide either your real name or an established Usenet pseudonym
following the words "Voter name:".
Indicate your vote in the brackets beside the group name. Valid votes
are YES, NO, ABSTAIN, and CANCEL. Examples of how to properly
indicate your vote (do not vote here):
[ YES ] example.vote.yes
[ NO ] example.vote.no
[ ABSTAIN ] example.abstention
[ CANCEL ] example.cancellation
Do *not* modify or delete any other information in this ballot.
Votetaking is automated, and any other changes to the ballot may
prevent your vote from being counted.
When you're finished, mail the ballot to <mcq@best.com>. Replying to
this message should work, but check the "To:" line. If you ordinarily
use a spam block, please delete it and use a valid address to vote.
If you do not receive an acknowledgment of your vote within three
days, contact the votetaker about the problem. You are responsible
for reading your ack and making sure your vote is registered
correctly.
-=-=-=-BEGINNING OF BALLOT: Delete Everything Before This Line=-=-=-=-
----------------------------------------------------------------------
Usenet Ballot: comp.lang.perl.moderated
This ballot is distributed blank in a Call for Votes | Leave this
posted to news.announce.newgroups or mailed from the | marker here:
votetaker. Other ballots may be rejected. | <CLPM-0001>
Add your name (and only your name) after the colon on the next line.
Voter name:
[Your Vote] Group (Place your vote in the empty brackets below.)
----------------------------------------------------------------------
[ ] comp.lang.perl.moderated
----------------------------------------------------------------------
-=-=-=-=-=-END OF BALLOT: Delete Everything After This Line-=-=-=-=-=-
DISTRIBUTION:
This CFV has been posted to the following newsgroups:
news.announce.newgroups
news.groups
comp.lang.perl.announce
comp.lang.perl.misc
Pointers directing readers to this CFV will be posted in the newsgroup
comp.lang.perl.modules and on the perl5-porters mailing list.
The CFV is also available by e-mail from the votetaker.
--
Rebecca Graham McQuitty Member, Usenet Volunteer Votetakers
------------------------------
Date: Wed, 10 Jun 1998 02:55:54 GMT
From: xuming@email.unc.edu (Xuming Wang)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <357df582.181121141@152.2.25.74>
abigail@fnx.com (Abigail) wrote:
>Bob Roklan (roklan_r@code80.npt.nuwc.navy.mil) wrote on MDCCXLIII
>September MCMXCIII in <URL: news:357DA4E9.DA495FD6@code80.npt.nuwc.navy.mil>:
>++ I am running Perl 5.003 on Windows 95. I would like to specify a
>++ but how can I tell perl to do the same for a specified directory and
>++ down?
>
>$ find . -name '*.htm' | xargs perl -i.old -p -e "s/foo/bar/g"
C:\>find . -name '*.htm' | xargs perl -i.old -p -e "s/foo/bar/g"
FIND: Parameter format not correct
Bad command or file name
--
Xuming Wang
------------------------------
Date: Wed, 10 Jun 1998 03:05:57 GMT
From: xuming@email.unc.edu (Xuming Wang)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <357ef7af.181678762@152.2.25.74>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> Bob Roklan <roklan_r@code80.npt.nuwc.navy.mil> writes:
>: perl -i.old -p -e "s/foo/bar/g" *.htm
>:
>:but how can I tell perl to do the same for a specified directory and
>:down?
>
>Use the Shell, Bob.
>
> % perl -i.orig -pe 's/\bfoo\b/bar/g' `find / -name '*.htm' -print`
C:\temp>perl -i.orig -pe 's/\bfoo\b/bar/g' `find / -name '*.htm' -print`
Can't open `find: No such file or directory
Can't open /: Permission denied
Can't open -name: No such file or directory
Can't open '*.htm': No such file or directory
Can't open -print`: No such file or directory
--
Xuming Wang
------------------------------
Date: 10 Jun 1998 03:39:05 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Command line substitution thru subdirectories
Message-Id: <6lkv4p$kvg$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
xuming@email.unc.edu (Xuming Wang) writes:
:C:\>find . -name '*.htm' | xargs perl -i.old -p -e "s/foo/bar/g"
:FIND: Parameter format not correct
:Bad command or file name
Stop bitching about not having tools. It's not our fault that you're
too lazy, stupid, or rude to bother to install an operating system.
You can't get any useful work done with your problem. If you want
to program, install a programming environment. If you prefer to
watch MTV, you know where to find it.
--tom
--
Build a system that even a fool can use, and only a fool will want to use it.
------------------------------
Date: 10 Jun 1998 03:36:58 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Command line substitution thru subdirectories
Message-Id: <6lkv0q$kvg$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
xuming@email.unc.edu (Xuming Wang) writes:
:C:\temp>perl -i.orig -pe 's/\bfoo\b/bar/g' `find / -name '*.htm' -print`
:Can't open `find: No such file or directory
Don't be stupid. You have to have operating system installed.
--tom
--
And on the seventh day, He exited from append mode.
------------------------------
Date: Wed, 10 Jun 1998 03:56:30 GMT
From: xuming@email.unc.edu (Xuming Wang)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <3580028e.184461858@152.2.25.74>
[courtesy cc of this posting sent to cited author via email]
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> xuming@email.unc.edu (Xuming Wang) writes:
>:C:\temp>perl -i.orig -pe 's/\bfoo\b/bar/g' `find / -name '*.htm' -print`
>:Can't open `find: No such file or directory
>
>Don't be stupid. You have to have operating system installed.
yes I am stupid that have win95 as my operating system.
I supposed you were answering Bob Roklan's question, I appolize if I was
wrong.
the orignal post by Bob Roklan:
<-----------------------
I am running Perl 5.003 on Windows 95. I would like to specify a
^^^^^^^^^^
substitution string for multiple files spanning specified directory and
its subdiredirectories.
I know that the following would work for the current directory....
perl -i.old -p -e "s/foo/bar/g" *.htm
but how can I tell perl to do the same for a specified directory and
down?
Info would be greatly appreciated. While I am here can I ask another
question? Ok, thanks. Does anyone know of a news server where I can at
least read comp.lang.perl.misc thru a news reader? Ours does not allow
you to search subjects.
----------------------->
--
Xuming Wang
------------------------------
Date: Wed, 10 Jun 1998 01:56:46 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: efficient comparisons
Message-Id: <EuBC2M.94J@news.boeing.com>
In article <6lkin6$1mmc$1@nntp6.u.washington.edu>,
Darwin O.V. Alonso <dalonso@u.washington.edu> wrote:
> Programming Perl (2nd Ed page 540) makes a point that
> $foo = $a || $b || $c; is much faster than the "if (){}else{}" construct.
>
> In trying to find both the minimum and maximum values in an array, I
> have the following snippet of code:
>
> $min = $max = $ar[0];
> for $i ( 1 .. $#ar ) {
> ( ($ar[$i] < $min ) && ($min = $ar[$i]) ) # min?
> ||
> ( ($ar[$i] > $max ) && ($max = $ar[$i]) ); # if not min, maybe max?
> }
>
> If it makes any difference, $#ar = 3000.
>
> Does anyone have any suggestions on making that code more efficient?
> How about more conceise, and equally efficient?
> I tried constructs like "$mini > $t[$i] &&= $t[$i];"
> but could not get them to run.
>
C-style indexing will be slower so you might try something like:
$min = $max = $ar[0];
for (@ar) {
$_ < $min and $min = $_ or
$_ > $max and $max = $_
}
HTH,
--
Charles DeRykus
------------------------------
Date: Tue, 9 Jun 1998 23:37:05 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: efficient comparisons
Message-Id: <1dadp71.xjmu4l14yoiejN@bay1-357.quincy.ziplink.net>
Jim Bowlin <bowlin@sirius.com> wrote:
> I benchmarked the following and it was about twice as fast as the
> orignal loop (on my machine).
>
> foreach (@ar) {
> $min = $_ if $_ < $min;
> $max = $_ if $_ > $max;
> }
Woops:
@ar = (2 .. 5);
foreach (@ar) {
$min = $_ if $_ < $min;
$max = $_ if $_ > $max;
}
print "min: $min\nmax: $max\n";
__END__
min:
max: 5
Add this before the foreach line:
$min = $max = $ar[0];
You can also modify the code so that the first element isn't repeated in
the foreach loop, but it probably won't save you much time.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 10 Jun 1998 02:39:06 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Electronic Fax?
Message-Id: <6lkrka$p83$1@comdyn.comdyn.com.au>
In article <357DE649.EF32EB3D@ipacs.com>,
Ong Joo Chin <jcong@ipacs.com> writes:
> Is it possible to write a PERL script (or any CGI script) that send data
It's perl for the program/interpreter, Perl for the language. If
that's what you mean, yes, it is possible, provided you have a fax
gateway that will allow you to interface with it. This could be a fax
modem, which you talk to directly, or a piece of software or api,
which allows you to talk through that.
If you don't have that hardware, you can't do it, unless you use some
third party public mail to fax gateway or something like that.
None of this has anything to do with perl.
> from the internet to a fax machine? If possible, what is the best
What does 'from the internet to a fax machine' mean? It really makes
no sense.
> language to use (C, PERL, shell script)? Is there any reference or codes
> that you can recommend?
Odd question. That depends on the hardware setup you use. it also
depends on a possible api that the vendor supplies. If you need to
talk to a fax modem directly, I suggest you find out first (somewhere
else) how that is normally done.
If you want to communicate through a serial port, I suggest you read
the perl faq.
Maybe what you should do is _first_ identify how you would do it, what
hardware you wish to use etc. Then you come back with a _specific_
question about the piece of perl which is not doing what you expect it
to do, and maybe we can help out then. The question you pose right now
is really too vague.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au |
Commercial Dynamics Pty. Ltd. | Curiouser and curiouser, said Alice.
NSW, Australia |
------------------------------
Date: Tue, 9 Jun 1998 23:37:09 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: filenames between UNIX and win95
Message-Id: <1dadphl.s66pup1mxmzzvN@bay1-357.quincy.ziplink.net>
Robert Friberg <robban@it-tkonsul.com> wrote:
> Tony Giordano <giordano@pobox.com> wrote <357C8DF7.DA72BA30@pobox.com>...
> > This doesn't work
> > c:\temp\file.txt
> > because the \t is sent as a tab.
> > c: emp\file.txt
>
> $filename = quotemeta $filename;
$filename = "c:\temp\file.txt";
$filename = quotemeta $filename;
print "$filename\n";
__END__
c\:\ emp\ile\.txt
Well, that was helpful. Might I suggest
$filename = 'c:/temp/file.txt';
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 10 Jun 1998 02:39:50 GMT
From: cmreynolds@hotmail.com (Chris Reynolds)
Subject: Input/criticism/anything?
Message-Id: <357df188.9699021@news.sprint.ca>
ok, so I went and tried to an ralias and this is what I have .. is
there a more efficent or just simply a better way of doing this .. and
the following is the script that i made ....
#!/public/bin/perl -w
die "\nUsage: &0 [-f filename] [-r alias]
$0 alias\n" if (&#ARGV < 0 $# ARGV > 4);
sub Usage {
warn "@_\n" if @_;
$! = 0;
die << EOF;
ralias [-f filename] [-2] alias
Options
-f to seartch the alias in the certain file
-r to get the real name of the alias
EOF
}
sub fop {
if (/\b($alias)\s+/) {
$_ =$;
}
if (/\ (\b/) {
print "$'\n";
}elsif (/</) {
$_=$';
chop;
print "$_\n";
}else {
print "$_\n";
}
}
}
sub fopr {
if (/\b$alias\s+/) {
$_=$;
if (/^\W+/) {
$_=$;
}
if (/\(\b/) {
print "$'\n";
}elsif (/</) {
$_=$';
/(\w+) \W+(\w+)/;
print "$1 $2\n";
}else {
print "no real name found\n";
}
}
}
if ($ARGV[0] eq '-f' and $#ARGV < 3) {
if ($ARGV[2] eq '-r') {
usage;
}
open (FILE, "$ARGV[1]") or die usage ("can't open $ARGV[1]\n");
$alias = $ARGV[$#ARGV];
while (<FILE>) {
chomp;
fop;
}
elsif ($ARGV[0] eq '-f' and $#ARGV < 4) {
if ($ARGV[2] ne '-r'){
usage;}
opne (FILE, "$ARGV[1]") or die usage ("can't open $ARGV[1]\n");
$alias = $ARGV[$#ARGV];
while (<FILE>) {
chomp;
chop;
fopr;
}
}elsif ($ARGV[0] eq '-r' and $#ARGV == 3) {
if ($ARGV[1] ne '-f') {
usage;}
open (FILE, "$ARGV[2]") or die usage ("can't open $ARGV[2]");
$alias = $ARGV[$#ARGV];
while (<FILE>) {
chomp;
chop;
fopr;
}
}elsif ($ARGV[0] eq '-r' and $#ARGV < 2) {
$alias = $ARGV($#ARGV[$#ARGV];
while (<STDIN>) {
chomp;
chop;
fopr;
}
}elsif ($#ARGV == 0) {
$alias = $ARGV[$#ARGV];
while (<STDIN>) {
chomp;
fop;
}
}else {
usage ("Not enough arguments")
}
------------------------------
Date: 10 Jun 1998 02:23:28 GMT
From: gebis@albrecht.ecn.purdue.edu (Michael J Gebis)
Subject: Re: McCabe complexity analysis
Message-Id: <6lkqn0$jgr@mozo.cc.purdue.edu>
Tom Christiansen <tchrist@mox.perl.com> writes:
} if (p)
}and
} if (p == NULL)
}When of course, there isn't.
Except, of course, that they are exactly the opposite.
But we know what you meant.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 09 Jun 1998 19:59:25 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: McCabe complexity analysis
Message-Id: <m3bts2otbm.fsf@windlord.Stanford.EDU>
Stefaan A Eeckels <Stefaan.Eeckels@ecc.lu> writes:
> Here's another rhetorical question: Why do even respected authors (and
> many more programming standards documents) state that you should write
> (in 'C'):
> handle = fopen(file_name, mode);
> if (handle == NULL) return -1;
> instead of the much more elegant:
> if ((handle = fopen(file_name, mode)) == NULL)
> return -1;
> I guess it's because not everybody has the required esthetic sense to be
> programming. It's an art form, after all.
Because:
if (handle = fopen (file_name, mode)) return -1;
looks like it was intended to be:
if (handle == fopen (file_name, mode)) return -1;
which is something completely different. I tend to agree with the school
of thought that says that assignments inside an if condition are usually
evil, because when I'm reading code quickly they're confusing to follow.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 10 Jun 1998 02:06:26 GMT
From: orwant@cyrano.media.mit.edu (Jon Orwant)
To: richard.q@virgin.net (Razor's Edge)
Subject: Re: Newbie seeks advice on scripts, cookies and forms.
Message-Id: <ORWANT.98Jun9220626@cyrano.media.mit.edu>
richard.q@virgin.net (Razor's Edge) writes:
What I want to do is use cookies to store the name and e-mail address
of client coming to the site. The site is to sell comics.
What I want to know, is how do I fill in a form via perl script from
cookies.
I am thinking that I need to generate the entire page within th
script, containing all the form bits and pieces?
That's usually the easiest way to do it. Lincoln Stein's article in
TPJ #3 is devoted to cookies. The code is online at http://tpj.com.
-Jon
------------------------------------
Jon Orwant http://tpj.com
Editor & Publisher, The Perl Journal
--
------------------------------
Date: 10 Jun 1998 04:13:13 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: offline mode?
Message-Id: <6ll14p$n8g$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
:If we take this any more offline, offtrack, offbase, we could debate the
:distinctions between transmission and transaction control protocols.
:Let the dizziest among us take the first shot . . .
+----------------------------------------------------------------+
| +------------------------------------------------------------+ |
| | +--------------------------------------------------------+ | |
| | | +----------------------------------------------------+ | | |
| | | | +------------------------------------------------+ | | | |
| | | | | +--------------------------------------------+ | | | | |
| | | | | | +----------------------------------------+ | | | | | |
| | | | | | | +------------------------------------+ | | | | | | |
| | | | | | | | +--------------------------------+ | | | | | | | |
| | | | | | | | | +----------------------------+ | | | | | | | | |
| | | | | | | | | | +------------------------+ | | | | | | | | | |
| | | | | | | | | | | W W 4 * f l s b e t W | | | | | | | | | | |
| | | | | | | | | | | h e , M o i u y x h h | | | | | | | | | | |
| | | | | | | | | | | a 0 I r n m t p e a | | | | | | | | | | |
| | | | | | | | | | | t g 0 M e m e l t | | | | | | | | | | |
| | | | | | | | | | | e 0 E t s i s o s ' | | | | | | | | | | |
| | | | | | | | | | | t t * h n ? d i s | | | | | | | | | | |
| | | | | | | | | | | h b D o n g e z | | | | | | | | | | |
| | | | | | | | | | | e o y R s o e t | | | | | | | | | | |
| | | | | | | | | | | v t E e t u Y b ! h | | | | | | | | | | |
| | | | | | | | | | | h e e C p o y ? e | | | | | | | | | | |
| | | | | | | | | | | e r s K p e u | | | | | | | | | | |
| | | | | | | | | | | l * a v t 2 p | | | | | | | | | | |
| | | | | | | | | | | l o l e o h 0 W o | | | | | | | | | | |
| | | | | | | | | | | ? f j t n a h i | | | | | | | | | | |
| | | | | | | | | | | u r 2 d t y n | | | | | | | | | | |
| | | | | | | | | | | s y 0 i ? t | | | | | | | | | | |
| | | | | | | | | | | t 0 t m ? | | | | | | | | | | |
| | | | | | | | | | | o e | | | | | | | | | | |
| | | | | | | | | | | s | | | | | | | | | | |
| | | | | | | | | | +------------------------+ | | | | | | | | | |
| | | | | | | | | +----------------------------+ | | | | | | | | |
| | | | | | | | +--------------------------------+ | | | | | | | |
| | | | | | | +------------------------------------+ | | | | | | |
| | | | | | +----------------------------------------+ | | | | | |
| | | | | +--------------------------------------------+ | | | | |
| | | | +------------------------------------------------+ | | | |
| | | +----------------------------------------------------+ | | |
| | +--------------------------------------------------------+ | |
| +------------------------------------------------------------+ |
+----------------------------------------------------------------+
--tom, who is certainly sufficiently imaginative
to require no stinking MIMES just to waste
space and confuse people.
--
if (instr(buf,sys_errlist[errno])) /* you don't see this */
--Larry Wall in eval.c from the 4.0 perl source code
------------------------------
Date: Wed, 10 Jun 1998 02:25:18 GMT
From: rbskipper@wimberley-tx.com (The Skipster)
Subject: Re: Perl Books?
Message-Id: <357dec88.47823990@news.wimberley-tx.com>
On 9 Jun 1998 17:08:19 GMT, mike@stok.co.uk (Mike Stok) wrote:
>In article <6ljlgt$pf1$1@taliesin.netcom.net.uk>,
>The Dukester <web1@netcomuk.co.uk> wrote:
>>Dear All,
>> I'm in the UK and was wondering if anyone could suggest a good Perl
>>book, which would be able to get my head around (I've done
>>basic, little bits of C+ and assembly) and use as a refernce guide? I
>>wouldn't want to spunk #50 on rubbish.
>
>Programming Perl by Wall Christiansen & Schwartz is a good reference book,
>you should probably use it in conjunction with the on-line docs on your
>system as time has moved on since it was published. Also, check out the
>errata page on O'Reilly's web site
>http://www.oreilly.com/catalog/pperl2/pperl2.current and mark up your
>copy.
>
>It's a good reference, and has a little tutorial material in it. If
>you want a tutorial book too then consider Learning Perl which is also
>published by O'Reilly.
>
>www.perl.com has some book reviews on line.
>
But of course, the best things in life are free. The documentation
that comes with your version of perl is extremely informative and
thorough. The FAQs at
http://language.perl.com/faq/index.html
are a must. And there's some fantastic reading to be found at
http://language.perl.com/CPAN/doc/FMTEYEWTK/index.html
You've got thousands of pages of very informative material at
asolutely no cost. (The books mentioned are very good, too, but don't
let them substitute for the basic documentation).
Enjoy,
Skipper
------------------------------
Date: Tue, 9 Jun 1998 22:14:32 -0500
From: REUBEN LOGSDON <rlogsdon@io.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Reading a file from the bottom up
Message-Id: <Pine.BSI.3.96.980609221246.17105A-100000@pentagon.io.com>
[posted and mailed]
you betcha
won't make that mistake again
shoulda been:
open(F,"<file") or die "$! on read file";
Unless someone else has a better way of checking return values?
Regards,
Reuben Logsdon
On Mon, 8 Jun 1998, Tom Phoenix wrote:
> On Sat, 6 Jun 1998, REUBEN LOGSDON wrote:
>
> > open(F,"<file");
>
> Even when your script is "just an example" (and perhaps especially in that
> case!) you should _always_ check the return value after opening a file.
> Thanks.
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
>
>
------------------------------
Date: 10 Jun 1998 01:59:41 GMT
From: orwant@cyrano.media.mit.edu (Jon Orwant)
To: "Dave" <hannum@oak.cat.ohiou.edu>
Subject: Re: Return cell contents to HTML dropdown menu
Message-Id: <ORWANT.98Jun9215941@cyrano.media.mit.edu>
"Dave" <hannum@oak.cat.ohiou.edu> writes:
I am looking for a snippet that reads the contents of a cell in a database
and returns those contents to a dropdown box in HTML. Anybody got anything?
There are many database engines, and many ways to get data from them,
and many ways to interpret "cell". But you probably want to be using
the CGI module to generate the HTML. In particular, the popup_menu()
function.
-Jon
------------------------------------
Jon Orwant http://tpj.com
Editor & Publisher, The Perl Journal
--
------------------------------
Date: 10 Jun 1998 03:04:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Stripping HTML coding from CGI data for Perl
Message-Id: <6lkt43$9sc$2@client3.news.psi.net>
Jonathan A. Laub (lakesoft@skypoint.com) wrote on MDCCXLIV September
MCMXCIII in <URL: news:6lknob$i1f$1@shadow.skypoint.net>:
++ I have a simple form that I is (would) be working with a small executable
++ just fine if I could simply strip off the HTML codes that are passed with
++ the variables.
use HTML::Parser;
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'
------------------------------
Date: Wed, 10 Jun 1998 02:36:41 GMT
From: garyg@gator.net (Gary M. Greenberg)
Subject: Re: Stupid syntax question
Message-Id: <MPG.fe7ba7c48b0f2d2989681@news.gator.net>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <677ce$16113a.fd@CLYDE>, ryelah@axess.net says...
> In article <6larkq$19bo$1@news.gate.net>, "gateway" <betabeta@geocities.com>
> wrote:
> > I just started learning Perl, so forgive me if this is stupid. I can't
> >seem to get the syntax right. what I want to do is use a loop to cycle
> >through all elements in an array, one at a time, using a variable as the
> >array index (ie &array[$counter]). can someone clear this up for me.
^^^ &array is a call to a subroutine.
it's $array[$counter] and TMTOWTDI.
foreach(@array) {
# do something with $_ which is implicitly given the current
# element's value.
...
}
foreach $element (@array) {
# do something with $element;
}
for ($i=0; $i < $#array; $i++) {
# do something with $array[$i];
}
for ($i=0; $i < @array; $i++) { # @array is evaluated as a scalar here.
# do something with $array[$i];
}
> >I'm sorry if this sounds simple, but I've tried everything I can think of.
> >
Except maybe reading a good Perl book; the Camel or Llama are preferred.
>
> Don't know if this is what your looking for..
> I taught myself out of a book
> and I'm still learning all the time but wouldn't an array be
> @array[$counter])
^^^^^^^^^^
This isn't what you wan't.
> ?
>
> Sorry if this doesn't help
>
It doesn't.
> Malaise
> Malaise@stray.to
Regards,
gary # Perl Apprentice
-=- The C Programmers' Reference -=-
http://www.gator.net/~garyg/C/c.html
-=- Avenue Programmers' Classes' Requests -=-
http://www.gator.net/~garyg/class.htm
------------------------------
Date: Tue, 9 Jun 1998 21:02:33 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Stupid syntax question
Message-Id: <MPG.fe7a53126a2ded99896b0@nntp.hpl.hp.com>
In article <MPG.fe7ba7c48b0f2d2989681@news.gator.net>, garyg@gator.net
says...
...
> for ($i=0; $i < $#array; $i++) {
> # do something with $array[$i];
> }
> for ($i=0; $i < @array; $i++) { # @array is evaluated as a scalar here.
> # do something with $array[$i];
> }
...
Now, both of those can't be right, can they?
Replace '<' by '<=' in the first loop.
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: Wed, 10 Jun 1998 02:19:24 GMT
From: garyg@gator.net (Gary M. Greenberg)
Subject: Re: Substr
Message-Id: <MPG.fe7b6709d497254989680@news.gator.net>
In article <357C3BEA.A04711B1@att.com>, ragunkel@att.com says...
> I'm trying to use substr to remove JUST the first 4 Characters from a
> String read form <STDIN>
>
> The String is a Fixed width Format:
^^^^^^^^^^^
sorta calls for unpack and a Template.
>
> " San Diego 51 test"
> " Portland 132 false"
> " Troy 12235 te"
>
>
> The problem is the output is:
>
> San Diego 51 test
> Portland 132 false
> Troy 12235 te
>
$T = "a4 a*";
...
$stdin = <STDIN>;
($t, $rest)=unpack $T, $stdin;
print "$rest\n";
...
> The code I'm working with is a follows:
>
> $shortline = substr( $line, 4, 100);
How do you know 100 won't change your line length?
> print "$shortline \n";
why add a space ^^?
>
gary # Perl Apprentice
-=- The C Programmers' Reference -=-
http://www.gator.net/~garyg/C/c.html
-=- Avenue Programmers' Classes' Requests -=-
http://www.gator.net/~garyg/class.htm
------------------------------
Date: Wed, 10 Jun 1998 04:43:33 GMT
From: abhidon@hotmail.com
Subject: why does this work?
Message-Id: <6ll2tl$26b$1@nnrp1.dejanews.com>
Hi,
Suppose my file has the following characters only :
"acbjvfdh" this file has nothing else in it. If I run this with perl, I get no
error message!
Whereas, if I append a ";" to the same string I start getting errors!
Why? what does a series of alphabets without any ";" mean to perl?
TIA
Abhijit
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 09 Jun 1998 20:21:56 -0700
From: Michael Burr <mburr@halcyon.com>
Subject: Win32: File glob causes floppy to chatter
Message-Id: <357DFBD4.8EE68221@halcyon.com>
Hello all,
I'm using the ActiveWare port of 5.003_07 and I've written an
application that sort thru the disk directory structure doing file globs
to collect up all the file names. I've noticed that every file glob
causes the "A" drive to chatter as if a seek is being done on it - only
problem is I'm reading the C drive! This makes for a VERY annoying
program when you've got 800+ directories to search thru.
Anybody else experience this or know what causes it? The following
snippet should demostrate the behavior...
foreach $dir (qw(/windows /windows/system)) {
#--- each file glob here will cause the "A" drive to buzz
chdir $dir;
foreach $fn (<*.*>) {
print $fn, "\n";
}
}
-----------------------------------------------------------------
Michael N. Burr
Renaissance Man Wanna-Be, Issaquah, WA
------------------------------
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 2826
**************************************