[6734] in Perl-Users-Digest
Perl-Users Digest, Issue: 359 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 23 23:07:25 1997
Date: Wed, 23 Apr 97 20:00:20 -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 Wed, 23 Apr 1997 Volume: 8 Number: 359
Today's topics:
1-D hash completely different from 2-D hash? (Peter Scott)
Re: C++Builder means Future. <ericmit@ix.netcom.com>
Re: case sensitive comparisons <eryq@enteract.com>
Re: case sensitive comparisons (David Alan Black)
Re: Getting a user's ip address? (Niksun)
Re: Interpolating subroutine names? <ajohnson@gpu.srv.ualberta.ca>
Re: Lisp is neither (was Re: Ousterhout and Tcl lost th ben@teco.net
list assignment won't untaint? (John F. Whitehead)
Re: Need CGI script to get email after user fills web f (Geoffrey Hebert)
Re: No syntax errors, but still the thing won't run (Mark Mills)
Re: No syntax errors, but still the thing won't run <sib@worldnet.att.net>
Re: Ousterhout and Tcl lost the plot with latest paper <graham.hughes@resnet.ucsb.edu>
Re: Output to a printer? <critter@quack.kfu.com>
Re: Perl/Cgi script (Geoffrey Hebert)
Re: Printing to Files. (Tad McClellan)
Re: Printing to Files. (John Stanley)
Re: printing variable names (Perl needs MACROS!) (David Combs)
Re: Regular Expression Help Newbie (Tad McClellan)
Sorting an array of arrays (Niksun)
What's the equivalant to sendmail with NT? (Gregory Reddin)
Re: wretched C++ (Was: Ousterhout and Tcl lost the plot (Jon S Anthony)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Apr 1997 01:30:44 GMT
From: pjscott-remove-to-email-sorry@euclid.jpl.nasa.gov (Peter Scott)
Subject: 1-D hash completely different from 2-D hash?
Message-Id: <5jmd44$3ln@netline-fddi.jpl.nasa.gov>
I'm misunderstanding something about the nature of hashes and LoL here.
Try this:
#!/usr/local/bin/perl -w
$x{foo} = "bar" # line 1
$x{foo}{baz} = "bletch"; # line 2
print "$foo{bar} $foo{bar}{baz}\n"; # line 3
The result of this is
bar bletch
which is different from what I expected, and what I get if I comment out
line 1:
HASH(0xcb814) bletch
I thought a hash could only take one value for a given key, and that
line 2 would change it from a string to a reference to an anonymous
hash. And I thought I understood references :-( (well, enough to be
able to do the above and get it right...)
Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
Platform:
osname=solaris, osver=2.4, archname=sun4-solaris
uname='sunos craftsman 5.4 generic_101945-34 sun4m sparc '
hint=previous, useposix=true, d_sigaction=define
Compiler:
cc='gcc', optimize='-O', gccversion=2.7.2
cppflags='-I/usr/ets/include'
ccflags ='-I/usr/ets/include'
stdchar='unsigned char', d_stdstdio=, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, randbits=15
Linker and Libraries:
ld='ld', ldflags =' -L/usr/ets/lib'
libpth=/usr/ets/lib /lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -lgdbm -ldbm -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
cccdlflags='-fpic', lddlflags='-G'
@INC: /usr/ets/lib/perl5/sun4-solaris/5.003 /usr/ets/lib/perl5 /usr/ets/lib/perl5/site_perl/sun4-solaris /usr/ets/lib/perl5/site_perl .
--
This is news. This is your | Peter Scott, NASA/JPL/Caltech
brain on news. Any questions? | (Peter.J.Scott at jpl.nasa.gov)
Disclaimer: These comments are the personal opinions of the author, and
have not been adopted, authorized, ratified, or approved by JPL.
------------------------------
Date: Wed, 23 Apr 1997 21:41:55 -0400
From: "Eric B. Mitchell" <ericmit@ix.netcom.com>
To: Kevin Handy <kth@srv.net>
Subject: Re: C++Builder means Future.
Message-Id: <335EBA63.ABB46634@ix.netcom.com>
Kevin Handy wrote:
>
> In article <bnelsonE8tK0C.8H3@netcom.com>, bnelson@netcom.com says...
> >
> >Frank C. Earl <fearl-no-spam-@-no-spam-airmail.net-no-spam-> wrote:
> >> On Wed, 16 Apr 1997 16:46:45 -0700, 34110s96@student.csi.cuny.edu
> >> wrote:
> >
> >> >I just got C++Builder and I have never seen a powerful RAD tool like
> >> >this one. Forget about the Visual Crap. C++Builder is the King of the
> >> >Hill and not Marketing hype of Microsoft.
> >
> >> And if only it was on Linux, we'd be in hog-heaven. Thing is, it's on
> >> MS-Windows.
> >
> >Who needs it? We're already in "hog-heaven" with easily the most robust
> >compiler around...and we have the source to it! Add gcc to a customized
> >emacs environment under X! Short of having the code write itself, what
> >else could one desire in a development environment?
>
> But C++Builder does write most of the code itself (at least for the
> user interface, and database access), which is what makes it sooo nice.
> I'd really like to see someone develop something like thus for
> Unix, X, and some database. That would really be nice.
Not sure about the database support, but you should look into Rogue
Wave's
zApp framework library and zApp Factory GUI builder. Unix and Win GUIs
from
the same tool. I tried a demo about a year ago, but my company wasn't
doing
any cross platform stuff, so we stuck with MSVC. Fun to play with
though.
--ebm
------------------------------
Date: Wed, 23 Apr 1997 21:22:15 -0500
From: Eryq <eryq@enteract.com>
To: lina@ty.com
Subject: Re: case sensitive comparisons
Message-Id: <335EC3D7.52C3215F@enteract.com>
Lina Trivedi wrote:
>
> I am trying to read a text file through my perl script and find matchs
> to certain strings, however, I am looking to make matches that are case
> sensitive. Currently, my script is matching strings without
> consideration to case. I have my script as follows:
>
> if ($_ eq "$FORM{'userid'}") {
>
> However this will match string to String or STRING or StrinG. Any clues
> to help me out? Thanks!!!
Well, all I can say is that the above *will* do a case-sensitive comparison.
Actually, you should write it without the wasteful double-quotes (wasteful
because you're making Perl do an unnecessary interpolation):
if ($_ eq $FORM{'userid'}) {
Unfortunately, you posted too little of your script for me to tell
what your problem might be. In general, though:
if ($a eq $b) { case-sensitive
if (lc($a) eq lc($b)) { cheap and easy case-insensitive
I'd start with simple debugging:
if ($_ eq $FORM{'userid'}) {
print STDERR "I think that $_ is eq to $FORM{'userid'}\n";
and see where that takes you...
HTH,
--
___ _ _ _ _ ___ _ Eryq (eryq@enteract.com)
/ _ \| '_| | | |/ _ ' / Hughes STX, NASA/Goddard Space Flight Cntr.
| __/| | | |_| | |_| | http://www.enteract.com/~eryq
\___||_| \__, |\__, |___/\ Visit STREETWISE, Chicago's newspaper by/
|___/ |______/ of the homeless: http://www.streetwise.org
------------------------------
Date: 24 Apr 1997 01:59:26 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: case sensitive comparisons
Message-Id: <5jmepu$nol@pirate.shu.edu>
Hello -
Lina Trivedi <lina@ty.com> writes:
>I am trying to read a text file through my perl script and find matchs
>to certain strings, however, I am looking to make matches that are case
>sensitive. Currently, my script is matching strings without
>consideration to case. I have my script as follows:
> if ($_ eq "$FORM{'userid'}") {
>However this will match string to String or STRING or StrinG. Any clues
>to help me out? Thanks!!!
Yes: something else is wrong. The eq operator isn't case-insensitive -
that would be sort of like the == operator ignoring signs. One possibility
is that neither of the two variables being compared contains anything.
I'd have to see more code to see whether/why that was true, but it's
got to be something like that.
Illustration of case sensitivity:
$FORM{userid} = "abc";
for ( qw(abc AbC ABC) ) {
if ($_ eq "$FORM{'userid'}") {
print "$_ matched\n";
}
}
Output:
abc matched
David Black
dblack@icarus.shu.edu
------------------------------
Date: Wed, 23 Apr 1997 23:32:39 GMT
From: niksun@lconn.net (Niksun)
Subject: Re: Getting a user's ip address?
Message-Id: <335e9ba0.16772505@news.inetw.net>
There is an environment variable that contains that data. It is
$ENV{'REMOTE_ADDR'}. So, to redirect according to a certain address,
you could do something like this:
if ($ENV{'REMOTE_ADDR'} =~ /.aol.com/) {
print "Location: gohere.com\n\n";
}
elsif {$ENV{'REMOTE_ADDR'} =~ /.netcom.com/) {
print "Location: gohere.com\n\n";
}
...
Niksun
-----
On Wed, 23 Apr 1997 14:40:19 -0500, Ian Feldberg
<ian.feldberg@jhuapl.edu> wrote:
>Does anyone know of an easy way to get the ip address of a remote user
>of a Perl script? That is, I'm writing a cgi script in perl and I want
>to return different data depending on the ip address of the person who
>invokes the script from within Netscape.
>
>- Ian
------------------------------
Date: Wed, 23 Apr 1997 21:13:32 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Interpolating subroutine names?
Message-Id: <335EC1CC.776B4E0C@gpu.srv.ualberta.ca>
[cc'd to cited author]
Tom Christiansen wrote:
! : eval "&do$items[$loc]";
!
! Never use eval just to construct variable names. It's
! wasteful, and traps exceptions you may not with to catch.
!
! This suffices:
!
! &{ "do$items[$loc]" }();
!
! is a much better approach. Better yet, store pointers to
! the function inside the data structure to begin with.
!
! --tom
...you're right of course---I've been experimenting
with building and checking strings of code eval'ing all
sorts of things and suppose I'm now suffering from some form
of false-laziness, or an even worse sin (especially given
perl's TMTOWTDI motto) single-mindedness. :-0
Thanks for the wake-up call, I've a few eval's to eval :-)
regards
andrew
------------------------------
Date: 24 Apr 1997 11:22:05 +1000
From: ben@teco.net
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <s6y7mhtmczm.fsf@aalh02.alcatel.com.au>
David Hanley <david@nospan.netright.com> writes:
> > the SPARC architecture has several instructions that C compilers doesn't
> > use, but which are convenient with type-tagged languages. the _fact_ is
> > that it has an the instruction, with Sun's recommended mnemonic "taddcctv",
> > that is specifically useful in Lisp, and specifically unused in C. other
> > instructions are also measurably useful in languages _other_ than C.
>
> 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..
Eriks original statement was only that dynamic typing was well
optimised in good lisp implementations, and that there was "often"
support from the hardware.
He didn't say "always" support from the hardware, or even "mostly"
support. Only that there are some hardware platforms which provide
some support. He then went on to prove that probably the most common
RISC platform (Sparc) has some support. I'd say he proved his case.
> > 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.
>
> Accusing someone of being stupid, and making stupid arguments oneself
> does make someone look like a fool though; though it's not who you're
> insulting.
I didn't see Erik claim that chips are designed for lisp. All he said
was that you can better implement dynamic languages with assembler
than compiling through C. This is true for all architectures, even
"new" ones.
No wonder Erik gets angry with the pure ignorance that is put forward
as fact.
------------------------------
Date: 23 Apr 1997 21:59:55 -0400
From: jfw@wral-tv.wral-tv.com (John F. Whitehead)
Subject: list assignment won't untaint?
Message-Id: <x7vi5di3j8.fsf@wral-tv.wral-tv.com>
Apparently although the following works to untaint a variable in 5.003:
$tainted =~ /^(safe_match)$/;
$untainted = $1;
the following does not:
($untainted) = ($tainted =~ /^(safe_match)$/);
i.e., $untainted is actually still considered tainted in the second example.
Is this an undocumented feature, or am I not grasping the tainted concept?
Thanks,
jfw
--
John F. Whitehead
(formerly of WRAL OnLine)
New address: jfw@well.com
------------------------------
Date: Thu, 24 Apr 1997 02:02:42 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: Need CGI script to get email after user fills web form
Message-Id: <5jmduo$8n7$1@news3.microserve.net>
Your lucky day. Follow instruction in my signature.
Follow path to perl cross reference.
This is a test site for a cross reference tool.
as of today, I have three scripts you may use.
emailform.cgi creates the form
emailsent.cgi receives the form and sends email
to a list.
email.cig picks up a list and send email.
remember to use password perlmisc.
They are mine, you may use for examples.
Please delete any reference to my site.
"Bharat Kurani" <bharat@antrix.com> wrote:
>I need CGI script to get email after user fills my web form
>once he fills in my web site form.
>Thanks
>bharat@antrix.com
------- signature ----------
Check out the Perl site!
http://www.microserve.net/~soccer/
use password perlmisc
Geat tool for Developers>
------------------------------
Date: Wed, 23 Apr 1997 05:08:46 GMT
From: mark@ntr.net (Mark Mills)
Subject: Re: No syntax errors, but still the thing won't run
Message-Id: <335d91b8.178400310@news.ntr.net>
On 22 Apr 1997 03:38:04 GMT, "Tammy Cotter" <cottert@sonic.net> wrote:
>By the way - thanks to Randall Schwartz for his "Learing Perl" book and
>Larry Wall for the language (and his humor) - It looks like a very cool
>language.
Me too... and thanks to the Toms and the rest of the Perl Irregulars
Group (don't abbreviate that...)
> I am looking forward to adding my advice to this group someday
>soon.
Please...
>Script follows:
>#!/usr/bin/perl
>$mailprog ='/usr/lib/sendmail';
>$domo='majordomo@lists.sonic.net';
>$subject='subcribe powermail';
>$success='http://www.lp-llc.com/powermail/success.htm';
>$oops='http://www.lp-llc.com/powermail/oops.htm';
>
>&read_input;
>&success_html;
>&send_mail;
>
>sub read_input {
>
> if ($ENV{'REQUEST_METHOD'} eq 'POST') {
> # Get the input
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/, $buffer);
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
What does this do? (I know but do you?)
Ans: Nothing. You aren't saving any of the data you grab from
the $buffer. Once you have each name and value where do they go?
This smells like you cut-n-pasted it from the old cgi perl 4 stuff.
And you left out the good bit.
change this to:
> ($name, $value) = split(/=/, $pair);
my ($name, $value) = split(/=/, $pair);
add in this:
$name=~ tr/+/ /;
$value=~ tr/+/ /;
$name =~ s/%(..)/pack("c",hex($1))/ge;
$value =~ s/%(..)/pack("c",hex($1))/ge;
$DATA{$name}=$value;
This saves the name/value pairs from the POST in an nice
associative array called %DATA
> }
> }
> else {&error;}
>
>}
>
>
>sub success_html {
>
> print "Location: $success\n\n"; #success
>
>}
>
>sub send_mail {
> # Open The Mail Program
> {
> open(MAIL,"|$mailprog -t");
>
> print MAIL "To: $domo\n"; #majordomo
> print MAIL "From: $email\n"; #new member
I am guessing that $email is what you were looking for from the
html form?
if the Form <input name=> bit is name'd email then you would change:
> print MAIL "From: $email\n"; #new member
print MAIL "From: $DATA{email}\n"; #new member
> print MAIL "Subject: $subject\n\n"; # subject
>
> print MAIL " $subject\n\n"; #body
>
> close (MAIL);
> }
>}
>
>sub error {
>
> print "Location: $oops\n\n"; # it failed
>
>}
>
>
That just might fix the basics, let me know if it still dies.
HTH and good luck...
AND FOR GOODNESS SAKE GET LINCOLN STEINS 'CGI.pm' INSTALLED AND LEARN
HOW TO USE IT. *sorry* I couldn't take it any longer... but I waited
to the end to yell. =}
--
Mark <mark@ntr.net>
Please don't sue my boss because you don't
understand the concept of free speech.
------------------------------
Date: Wed, 23 Apr 1997 22:13:31 -0400
From: Scott Blanksteen <sib@worldnet.att.net>
Subject: Re: No syntax errors, but still the thing won't run
Message-Id: <335EC1CB.7D03@worldnet.att.net>
Kevin Cotter wrote:
> 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.
Try running the script from the command line. Assuming your script
uses the POST method:
1. Create a simple test data file. Assume your script takes inputs
labeled name and age, create a file containing, for example,
"name=Fred&age=41" (without the quotes, of course.)
2. Save the file as "in.txt". Use "wc in.txt" to find out how many
characters are in your file.
3. Set the environment variable CONTENT_LENGTH to the number of chars
in "in.txt".
4. Set the environment variable REQUEST_METHOD to "POST".
5. Now type "<perl> -w yourcgi < in.txt > out.html".
6. Check "out.html" for your results. Note that out.html should
start like:
Content-type: text/html
<your html stuff here>
If out.html does not start exactly like this you will get "Document
contains no data".
Scott
PS - Or, you can use CGI.pm which handles most of the grungy stuff
for you.
------------------------------
Date: 23 Apr 1997 01:03:42 -0700
From: "Graham C. Hughes" <graham.hughes@resnet.ucsb.edu>
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <87hggyp3m5.fsf@A-abe.resnet.ucsb.edu>
-----BEGIN PGP SIGNED MESSAGE-----
>>>>> "Alexey" == Alexey Goldin <alexey@oddjob.uchicago.edu> writes:
Alexey> Have you tried SIOD? CLISP?
Quite frankly, since I discovered SWIG
(ftp://ftp.cs.utah.edu/pub/beazley/SWIG) any of Perl, Python, Tcl, and
Guile became easily extensible scripting languages. Thus, I get just
about anything I want, and can judge languages on other merits, such
as libraries or asthetic implications.
As a side note, are there any proposals in the works to create a
comp.lang.advocacy newsgroup where this sort of thing would be allowed
full reign? I can't fiddle the followups as would be my normal wish
on a thread this crossposted because I can't in good faith send them
anywhere. comp.lang.misc is for things other than advocacy
``discussions''.
- --
Graham Hughes http://A-abe.resnet.ucsb.edu/~graham/ MIME & PGP mail OK.
const int PGP_fingerprint = "E9 B7 5F A0 F8 88 9E 1E 7C 62 D9 88 E1 03 29 5B";
#include <stddisclaim.h>
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3
Charset: noconv
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface
iQCVAwUBM13CaiqNPSINiVE5AQF1MAP8CkOLQA3jCoVbO7H7QuRs42praU182Enb
QVi4jfP6JPdjakpe4W2nqH/qyViGO8p9ERbwwqc88hCuG/3QEUpg4UzrFf4XTNiF
hTtuCLSC7vVX54uCHFf6nysC+mqGPShW4rxIUAqjOjBYtipiPOZcpbOZVPhxvmRX
bOUh0qXV9Jk=
=caTl
-----END PGP SIGNATURE-----
------------------------------
Date: Wed, 23 Apr 1997 17:29:05 -0700
From: "Charles F. Ritter" <critter@quack.kfu.com>
Subject: Re: Output to a printer?
Message-Id: <335EA951.57C59FBB@quack.kfu.com>
Bob wrote:
>
> I need to output the result of a script in Unix to a printer.
> To make things complicated, my boss would really like it to go to
> printer that's on a Win95 network. I see two ways to do this: Either
> write a quick VC++ or VB program, or write a Unix program that puts
> the output in a file, and another VC++ or VB program that occasionally
> uses Net::FTP to get that file and output it to the printer. Anybody
> see another way, or can make a recommendation? Thanks. I haven't
> seen any CPAN modules referring to this.
>
> - Bob
> xxbbell@voicenet.comxx
> remove x's to reply
I think the best way to make your network printers available across
platforms is through samba. This is a big installation/support issue
though - it's no quick fix.
--
Charles Ritter
Microsoft NT - when they are finally finished it will be the best
documented unix operating system on the market.
------------------------------
Date: Thu, 24 Apr 1997 01:28:06 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: Perl/Cgi script
Message-Id: <5jmbtt$81e$1@news3.microserve.net>
Some times I just can not resist and have to respond.
BBurns@Cbclegal.com wrote:
>Why does my webserver eventually
What do you mean eventually?
Is this some thing that happens during a one day period?
Is the problem only after the counts get high?
> slow down since the addition of CGI
>scripting (mainly multiple counter programs)???
How many?
Did you add universal counters for all pages from
a system administrators view? How busy was the
server before the addition of counters?
Immagine a market or bank with multiple stations to
service you. Now they remove one of the stations
for servicing your request, but require you to go there
to pickup a number. If this happened in real life,
the service level of the establishment would be severly
impacted at busy times.
Well, buy adding counter, you do this to your customers!
Forget the counter if they impact your service.
> The counters are Perl
>executables. The webserver is an Alpha 166, Nt 3.51 workstation,
>Netscape Comm. Svr.
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
------- signature ----------
Check out the Perl site!
http://www.microserve.net/~soccer/
use password perlmisc
Geat tool for Developers>
------------------------------
Date: Wed, 23 Apr 1997 17:49:06 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Printing to Files.
Message-Id: <2l3mj5.0s8.ln@localhost>
Mitchell Verter (mcv@ikos.com) wrote:
: Comrades in perl,
: I thought I knew my perl, but I've been stuck on this problem for too
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: long. i have been trying to simply write to a file, but it seems that
^^^^
You should have consulted the free documentation that is included
with the perl distribution.
: some intermediate buffering is getting in my way.
:
: !. I open up the file handle:
: open (OFILE, ">$outfile");
: 2. I try to print to the file
: print OFILE "$statement";
:
:
: I've noticed that the file remains empty until maybe the 20th print
: call. At that point, some of the text is dumped out into the file, but
: some of it still remains in limbo. Therefore, I can not generate a full
: file of text because some of it still seems to remain in a buffer
: somewhere.
close(FILEHANDLE) should also flush the buffer (they are closed/flushed
when the script ends too).
Do you mean that even after the script exits, there is still some
stuff missing from the file?
: Does anyone have any idea what might be happening here and how I might
: be able to fix it?
The perl man pages know how you might fix it.
: Are there any buffers to flush?
^^^^^^ ^^^^^
Yep.
grep buffer *.pod | wc -l
56
grep flush *.pod | wc -l
18
So there is about seventy places that may offer some help...
: Can anyone help?
The perl man pages can help.
: Please write me personally and/or post to this group if you can. Thanks
: a heap.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 24 Apr 1997 01:14:25 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Printing to Files.
Message-Id: <5jmc5h$e8u@news.orst.edu>
Why does your article refer to an irrelevant parent?
In article <335E7D90.49BE@ikos.com>, Mitchell Verter <mcv@ikos.com> wrote:
>Comrades in perl,
>
> I thought I knew my perl, but I've been stuck on this problem for too
>long. i have been trying to simply write to a file, but it seems that
>some intermediate buffering is getting in my way.
Words of wisdom.
> Does anyone have any idea what might be happening here
As you say,
>some intermediate buffering is getting in my way.
>and how I might be able to fix it?
Perl 5 Desktop Reference, ISBN 1-56592-187-9, page 39, "$|".
------------------------------
Date: Thu, 24 Apr 1997 02:30:28 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: printing variable names (Perl needs MACROS!)
Message-Id: <dkcombsE94Eys.7zA@netcom.com>
In article <5j5vk5$lqc@netnews.upenn.edu>, sdm <sdm@red.seas.upenn.edu> wrote:
> I am wondering if there is a way to print out the actual name
>of a variable, as well as what the variable contains. Something like this:
>
>foreach $os ($Windows,$Windows31,$Windows95,$WindowsNT) {
> print $os,"\t\t",$os,"\n";
>}
>
>Where the first $os is the name of the variable, not what is contained in it.
...
This is where MACROS could come in useful -- eg for writing an ASSERT
macro.
In the language I use ("Mainsail"), there are macros provided
AS PART OF the language (not merely via preprocessor). Here
is my ASSERT in that language:
define :
assert(condition,str) = [BEGIN "zzAssert" :
if NOT(condition) thenb # see also bridge.hdr. :
errMsg(eol&"ASSERT FAILED!!!: (condition): " & str & eol); :
end; END "zzAssert"]; :
where thenb means then begin, and eol means newline,
and & means concat-string. And "" within a string gens a single quote.
Here are some others I use all the time:
:
zhv(v) = [requiresTypeNum(v)" v= "&cvs(v)&" "], # For " value= 14.72 " :
zhvCm(v) = [requiresTypeNum(v)" v= "&cvs(v)&", "], # Same as zhv, wth COMMA. :
:
zhsv(str) = [requiresTypeString(str)" str= "&str&" "], # For string values. BAD. Use zhqsv :
zhQsCm(str) = [requiresTypeString(str)"""" & str & """" & zhcbb], # zhqs(s1) --> |"foo", | :
:
zhqv(v) = [requiresTypeNum(v)"""" & cvs(v) & """"], # QUOTES around cvs(VARIABLE) :
:
zhSQv(str) = [requiresTypeString(str)" str= """&str&""" "], # --> quotedStringVal. BAD :
zhqsv(str) = [requiresTypeString(str)" str= """&str&""" "], # --> quotedStringVal. :
:
zhSQvcm(str) = [requiresTypeString(str)" str= """&str&""", "], # --> quotedStringVal & BAD :
zhQsVCm(str) = [requiresTypeString(str)" str= """&str&""", "], # "quotedStringValue & CoMma" :
These zh-macros are exactly what you are asking for -- types out
the name of the variable, AND then the value. Plus since this
language is strongly typed, I put in an error check to verify
that I have the right type -- I get a compile-error if not.
Wouldn't it be nice if Tom C. etc put in such a macro feature,
WITHIN the language...
------------------------------
Date: Wed, 23 Apr 1997 17:33:37 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Regular Expression Help Newbie
Message-Id: <1o2mj5.9q8.ln@localhost>
Andreas Karrer (karrer@ife.ee.ethz.ch) wrote:
: In article <335D6579.7DDA@pcsltd.com>, Deepak Thadani wrote:
: >Hello,
: > I have a perl script in which
: >$_ = "881 /usr/spool/mmdf/lock/home"
: >
: >What I want to do is get the number (in this case 881) into a variable
: >called $VALUE. This is what I've got, which only seems to return
: >the 1.
: >
: >$VALUE = /[0-9]*\S\//;
: In a scalar context a pattern match returns the number of times it
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: matched. The assignment to a scalar variable above creates a scalar context.
^^^^^^^
No it doesn't. It returns a 1 (if it matched) or a null string (if
it did not match).
-------------------
#! /usr/bin/perl -w
$_ = "Andreas Karrer Andreas Karrer Andreas Karrer Andreas Karrer";
$value = /Andreas/g;
print "it matched $value times\n";
-------------------
[ snip the correct stuff ;-) ]
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Wed, 23 Apr 1997 23:49:33 GMT
From: niksun@lconn.net (Niksun)
Subject: Sorting an array of arrays
Message-Id: <335e9c35.16921801@news.inetw.net>
I've created a link page in HTML with a table of contents and
sections, etc... I can sort the table of contents easily, but I'm
having trouble sorting the links in each of the sections. Here's what
some of my HTML looks like:
...
<!--begin: SectionX-->
<A HREF="http://blah1">link1</A><BR>
<A HREF="http://blah2">link2</A><BR>
...
<!--end: SectionX-->
<!--begin: SectionY-->
<A HREF="http://blah3">link3</A><BR>
<A HREF="http://blah4">link4</A><BR>
...
<!--end: SectionY-->
...
Now, I want to sort all those links by their title/name, but I also
want to sort the sections. So, I read the sections in an array:
###############
# Sort links subroutine
sub sort_links {
open(FILE,"$file") || die &error(no_file);
@lines = <FILE>;
close(FILE);
foreach ($i = 0; $i <= @lines; $i++) {
if ($lines[$i] =~ /<!--begin: (.*)-->/) {
$i++;
$section = "$1";
push(@SECTION{$section}, $section);
foreach ($j = $i; $j <= @lines; $j++) {
if ($lines[$j] =~ /<!--end: $section-->/) {
$j--;
$n = 0;
foreach ($k = $i; $k <= $j; $k++) {
$SECTION{$section}[$n] = $lines[$k];
$n++;
}
}
}
}
}
}
Now, is this the best way to read in all the sections and their links?
AND, what's the best way to sort the sections and their links and then
re-write the sorted arrays to the HTML file? Thanks. Please reply
via e-mail.
Niksun
niksun@lconn.net
------------------------------
Date: Thu, 24 Apr 1997 02:30:14 GMT
From: ranger@onramp.net (Gregory Reddin)
Subject: What's the equivalant to sendmail with NT?
Message-Id: <335ebd3e.818655@news.onramp.net>
Hi all:
I've moved from a Unix based web server to Windows NT. Now, my perl
scripts that use sendmail don't work anymore. What can I use on NT
that's the equivalant to sendmail?
Also, each of these scripts used to create a log file but this doesn't
work either.
Any help would be greatly appreciated.
Gregory
------------------------------
Date: 24 Apr 1997 01:41:14 GMT
From: jsa@alexandria (Jon S Anthony)
Subject: Re: wretched C++ (Was: Ousterhout and Tcl lost the plot with latest paper)
Message-Id: <JSA.97Apr23214114@alexandria>
In article <5jl2rn$5gf$1@darla.visi.com> thornley@visi.com (David Thornley) writes:
> When the dust is settled, C++ will have many of the things I like
> about Lisp,
??!?!? Like what????
> (Yes, there is at least one freely available garbage collection
> library for C++.)
Yes, there are several "freely" available conservative collectors that
can be bolted on to your application. There is nothing C++ specific
about them.
> In the meantime, I suggest that, when you spend hours in frustration
> with your C++ system, let your vendor know. (You should have seen
I guess the question is, why? Why do this when there are readily
available viable alternatives which don't have this problem?
Certainly people do go through this, but why? I suppose this is
really, "why does management force such lunacy on their technical
staff when they have no knowledge or understanding for any of the
rationales or consequences involved?"
/Jon
--
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com
------------------------------
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 359
*************************************