[6727] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 352 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 23 09:07:15 1997

Date: Wed, 23 Apr 97 06:00:39 -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: 352

Today's topics:
     Re: 2D matrices (Kyzer)
     [Help] converting numbers to formatted strings <christian.aust@post.rwth-aachen.de>
     Re: [Q] who to return images (Roman Bloeth)
     Re: C utils for Perl (Kyzer)
     Re: deleting the current element from a list (David Alan Black)
     Re: Get Chars up to first | without splitting <mcampbel@tvmaster.turner.com>
     Re: HELP! Matching a multi line pattern and replacing i <a.aitken@unl.ac.uk>
     Re: HELP:  Redirection with Perl... (Kyzer)
     Re: help: find pattern, then go down 3 lines <a.aitken@unl.ac.uk>
     HELP:flock not implemented (B Amavasai)
     HELP? with loop test <weav@apollo.havant.ibm.com>
     Re: HELP? with loop test (Mike Stok)
     Re: How do I create an array of sockets (Mike Stok)
     Re: I/O on serial device? (Michael Constant)
     Re: Last item in list is screwed (Michael Constant)
     Re: Lisp is neither (was Re: Ousterhout and Tcl lost th <sdm7g@virginia.edu>
     Re: Lisp is neither (was Re: Ousterhout and Tcl lost th (Cyber Surfer)
     Re: Multiple Page Forms????? (Tad McClellan)
     Re: need short script to replace txt file without fefre <a.aitken@unl.ac.uk>
     Re: No GUI environment for Perl? <alf@orion.it>
     Re: Odd array sizing information <a.aitken@unl.ac.uk>
     Re: Perl as its own metalanguage? <tchrist@mox.perl.com>
     Re: PERL Editor <a.aitken@unl.ac.uk>
     Re: perl NOT enabled???? win95 - MS server... Please he (Kyzer)
     Re: Perl/Cgi script (Kyzer)
     Re: Regular Expression Help Newbie (Tad McClellan)
     sendmail is stripping-out body of message with sendmail x@apocalypse.org
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 23 Apr 1997 09:53:07 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: 2D matrices
Message-Id: <5jkm63$s3h@info.abdn.ac.uk>

>From the lips of Russ Allbery sprang:
: man perllol has a lot of details on precisely how this works, and more
that's perlLoL you mean...

Someone write a version of man(1) that isn't case dependant!

--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac   |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com  |University or AUCC, thankfully.***** |always!
StudentCode(v1.0) BSc A Y-- C++ E L W- G+ X? P-- T++ F M H++


------------------------------

Date: Wed, 23 Apr 1997 13:50:49 +0200
From: Christian Aust <christian.aust@post.rwth-aachen.de>
Subject: [Help] converting numbers to formatted strings
Message-Id: <335DF799.6F31@post.rwth-aachen.de>

Hi!
I have to write some Perl code that converts a floating point currency
into a string that looks like 12.223,30. That means: a comma used
instead of the decimal dot, a dot to seperate each group of thousands
and always 2-digit precision.

Can anyone *PLEASE* help me?

-  Christian

 /**************************************************
                    Christian Aust
      email: Christian.Aust@post.RWTH-Aachen.de
               http://137.226.254.148/
  **************************************************/


------------------------------

Date: 23 Apr 1997 05:41:00 +0100
From: Roman@pussycat.ping.de (Roman Bloeth)
Subject: Re: [Q] who to return images
Message-Id: <6VQwrFsKjQB@pussycat.ping.de>

Hello b.wilkinson and all others!


Thanks to all people answering my misplaced question about returning  
images from a perl to html (cgi).
The clue is that I didn't think about the fact that passing ascii is about  
the same as passing binary within unix. And I should have known since I'm  
working with unix myeslf...

So, sorry and thanks a lot!
Roman.



I bought dehydrated water... but I don't know what to add


------------------------------

Date: 23 Apr 1997 09:45:53 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: C utils for Perl
Message-Id: <5jkloh$s3h@info.abdn.ac.uk>

>From the lips of Henry Avatar Chan sprang:
: Hi,

: I was just wondering if there are any C equivalents functions for
: Perl?
: Anyone written any subroutines?

I think Larry Wall wrote one or two in the Perl source :)

--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac   |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com  |University or AUCC, thankfully.***** |always!
DC.W f+++ s+++ df h++++ Csilv a+ $+++ m d--- WL++ Fr---- Bslobber


------------------------------

Date: 23 Apr 1997 11:20:33 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: deleting the current element from a list
Message-Id: <5jkra1$924@pirate.shu.edu>

Hello -

rmshair@uiuc.edu (Bob Shair) writes:


>Is there an elegant (or just good) way to delete the current element 
>from a list when in a foreach loop?

>I'm merrily foreaching through a list, using
>   foreach $MCD (grep(/00000MCD/,@nontriv)) {
>   if ($pages{$LCD} == $pages{$MCD}+1)     {

>at that point, I want to delete $MCD from the @nontriv list.

>The difficulty I'm having is that I don't know WHERE in the list I am.

You could let grep do the work:

@nontriv = grep { /00000MCD/ and $pages{$LCD} != $pages{$_} + 1 } @nontriv;

If you do use the foreach approach (which might make sense, depending on
what else is going on), the best thing might be to store the good lines
in a new array as you go along.  (Also depending on the size of the
data, etc....)

David Black
dblack@icarus.shu.edu


------------------------------

Date: 23 Apr 1997 07:58:53 -0400
From: Mike Campbell <mcampbel@tvmaster.turner.com>
Subject: Re: Get Chars up to first | without splitting
Message-Id: <r567xelzlu.fsf@tvmaster.turner.com>

"christop@ozinter.co.jp" <christop@ozinter.co.jp> writes:

> 001|something|something else|and some more
> 
> - reading into $line a line at a time and I want to just put the 001 bit
> into $FirstBit.

($FirstBit) = $line =~ /^(.*?)\|/;

or 

$FirstBit = (split(/\|/, $line))[0];




------------------------------

Date: Wed, 23 Apr 1997 13:04:17 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: HELP! Matching a multi line pattern and replacing it
Message-Id: <335DFAC1.1918@unl.ac.uk>

David Millier wrote:
> 
> I need to match somthing that looks like this:
> New files in F:\ozzy_data\buckeye
> 
>  04/03/97 05:35p 59,525 Backup of index.wbk
>  04/04/97 01:42p 59,591 index.htm
>  03/26/97 11:26a 2,179 Whats_New.txt
> 
>  New files in F:\ozzy_data\buckeye\OEM_DOCUMENTS
> 
> 
>  New files in F:\ozzy_data\buckeye\OEM_DOCUMENTS\CUSTOMER_NOTIFICATION
> 
> Need to remove the "New files in ........." followed by two blank lines.
> This takes out the listings of new files in directorys that have none. I am
> simply having trouble matching a multi-line string(cant use foreach)
> recursivly. Thanks in advance for any help. PS. Reply here, i have no email
> currently.

This from perlvar.html (or perlvar.1 man page)

$/ The input record separator, newline by default. Works like awk's RS
variable, including
     treating blank lines as delimiters if set to the null string. You
may set it to a multicharacter string
     to match a multi-character delimiter. Note that setting it to
``\n\n'' means something slightly
     different than setting it to ``'', if the file contains consecutive
blank lines. Setting it to ``''
     will treat two or more consecutive blank lines as a single blank
line. Setting it to ``\n\n'' will
     blindly assume that the next input character belongs to the next
paragraph, even if it's a newline.
     (Mnemonic: / is used to delimit line boundaries when quoting
poetry.) 

Set this value to "New files in " and test the input record for /\n\n/:

#! /usr/local/bin/perl -w

require 5.003;
use strict;

my ($/);

$/ = "New files in ";
open (IN, "new_files.txt");
open (OUT, "> new_files.out");
while ( <IN> ) {
    if (!/\n\n/) {
	print OUT; # this already has blank lines to separate directories
    }
}
close (IN);
close (OUT);

exit 0;

Alastair.


------------------------------

Date: 23 Apr 1997 10:09:12 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: HELP:  Redirection with Perl...
Message-Id: <5jkn48$s3h@info.abdn.ac.uk>

>From the lips of Scott sprang:
: You need to escape the $5
The program with the $5 works fine, however this assume you haven't just
done a /(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/

: $foo="the pike";
:   print <<"EOFISH";
: My email address is <a href="mailto:me\@home.net">me\@home.net</a>
: I charge \$5 for unsolicited mail. My favourite fish is $foo.
: EOFISH
Yep, full marks :)
--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac   |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com  |University or AUCC, thankfully.***** |always!
Britcode(v1.1): Brit(S) H+++: U+++: a18 s+:- hf++>+++ b+ m+ x? X---:+
P-- S+++ M++ R-- A C-- T--- TV+ Ci MuI+ MuR++ MuJ--- Am+++ Ac+ B+ V---


------------------------------

Date: Wed, 23 Apr 1997 13:11:33 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: help: find pattern, then go down 3 lines
Message-Id: <335DFC75.4594@unl.ac.uk>

David Alan Black wrote:
> 
> Hello -
> 
> Alastair Aitken <a.aitken@unl.ac.uk> writes:
>
> >Set up a count when you find the pattern and just count through the
> >three lines:
> 
> >$count = 0;
> >$test = 0;
> >while ( <> ) {
> >    $count++;
> >    if ($test == ($count + 3)) {
> 
> I think you mean:  if ($count == ($test + 3)) {...}

I thought i also wrote:

    if ($test == ($count + 3)) {
	&do_this;
    }
    if (/$pattern/) {
	$test = count + 3;
    }

That way test is valued as the end point of the search as soon as the
start point is reached.  $count++
then reaches $test three lines later.  If $test is set to $count at the
start then your method works.

I can't really remember exactly what I did now but I think that's
slightly clearer.

Alastair.


------------------------------

Date: 23 Apr 1997 12:36:47 GMT
From: elp95bpa@stoat.shef.ac.uk (B Amavasai)
Subject: HELP:flock not implemented
Message-Id: <5jkvov$4u0$1@bignews.shef.ac.uk>

I've just got a script which contains the flock command. However whenever
I run the script I get a "flock() not implemented" error. Any idea what's
going wrong? I'm using Solaris. Is there a direct replacement for flock?

Thanks.

Regards,
Bala


------------------------------

Date: Wed, 23 Apr 1997 12:07:49 +0100
From: Nick Weavers <weav@apollo.havant.ibm.com>
Subject: HELP? with loop test
Message-Id: <335DED85.237C@apollo.havant.ibm.com>

I would like to test for the nextitem procedure returning
either nothing (undef, undef) ? or something that would
indicate that there are no more items.
An item has a name and a value and if there is one that is
what would be returned as a two element.

Is there someway I can treat ($name, $value) as a scalar
so that it reflects the number of elements in the list ?

while ((($name,$value) = nextitem($parm_str)) > 0)
{                      
        print "NAME :
$name\n";                                                 
        print "VALUE:
$name\n";                                                 
      }

Any help much appreciated.

Thanks,
Nick.
-- 
Nick Weavers, IBM SSD, Havant, PO9 1SA, UK. e-mail: weav@hursley.ibm.com
Tel: 011-44-(0)1705-486363 ext 5121  Fax: 011-44-(0)1705-499278


------------------------------

Date: 23 Apr 1997 12:14:49 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: HELP? with loop test
Message-Id: <5jkufp$181@news-central.tiac.net>

In article <335DED85.237C@apollo.havant.ibm.com>,
Nick Weavers  <weav@apollo.havant.ibm.com> wrote:
>I would like to test for the nextitem procedure returning
>either nothing (undef, undef) ? or something that would
>indicate that there are no more items.
>An item has a name and a value and if there is one that is
>what would be returned as a two element.
>
>Is there someway I can treat ($name, $value) as a scalar
>so that it reflects the number of elements in the list ?
>
>while ((($name,$value) = nextitem($parm_str)) > 0)

You can just return a 0 length list using return without anything to
return - if the caller was expecting an array it gets a 0 length list, if
a scalar was expected then the undefined value is returned e.g.

#!/usr/local/bin/perl -w

use strict;
use vars qw/$counter $c $s/;

sub nextitem {
  if ($counter < 5) {
    $counter++;
    return $counter, 'something else';
  }
  return;
}

$counter = 0;
while (($c, $s) = nextitem) {
  print "got: $c, $s\n";
}

print "finished\n";

__END__

You can use the debugger to see what the array assignment returns to the
while (using perl -de 1):

  DB<1> print scalar ((@list) = qw/foo bar baz/) ? 'true' : 'false'
true
  DB<2> print scalar ((@list) = ()) ? 'true' : 'false'
false
  DB<3> print scalar ((@list) = (undef, undef)) ? 'true' : 'false'
true

The value returned is the number of assignments which were made into the
target list:

  DB<4> $count = ($a, $b, $c, $d) = (100, 200, 300)

  DB<5> X count
$count = 3

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@psa.pencom.com                |      Pencom Systems Administration (work)


------------------------------

Date: 23 Apr 1997 11:59:58 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: How do I create an array of sockets
Message-Id: <5jktju$5k@news-central.tiac.net>

In article <335D4BAC.725A@emeryworld.com>,
Aditya Mishra  <axmishra@ewwmis1.cnf.com> wrote:
>How do I create an array of file descriptors in perl.
>When I use hard references to store the file descriptors
>in an array I end up with the same glob .

There's a chunk in the new FAQ (http://www.perl.com/FAQ/ is a place to
start looking if you have web access, I think the new FAQ will be part of
the 5.004 distribution which is on the horizon...)

How can I make a filehandle local to a subroutine? How do I pass filehandles
between subroutines? How do I make an array of filehandles?

   You may have some success with typeglobs, as we always had to use in
   days of old:

    local(*FH);

   But while still supported, that wasn't the best to go about getting
   local filehandles. Typeglobs have their drawbacks. You may well want
   to use the FileHandle module, which creates new filehandles for you
   (see the FileHandle manpage):

    use FileHandle;
    sub findme {
        my $fh = FileHandle->new();
        open($fh, "</etc/hosts") or die "no /etc/hosts: $!";
        while (<$fh>) {
            print if /\b127\.(0\.0\.)?1\b/;
        }
        # $fh automatically closes/disappears here
    }

   Internally, Perl believes filehandles to be of class IO::Handle. You
   may use that module directly if you'd like (see Handle), or one of its
   more specific derived classes.

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@psa.pencom.com                |      Pencom Systems Administration (work)


------------------------------

Date: 23 Apr 1997 05:55:05 -0700
From: mconst@soda.CSUA.Berkeley.EDU (Michael Constant)
Subject: Re: I/O on serial device?
Message-Id: <5jl0r9$rnh@soda.CSUA.Berkeley.EDU>


Jamie Zawinski  <jwz@netscape.com> wrote:
>	open(DEV,"</dev/ttyf1");
>	print DEV "AT\n";

You're trying to print to a filehandle that you only opened for
reading.  If you change the first line to

    open(DEV, "+</dev/ttyf1");

then it should work fine.  Note that running your script with
perl -w will warn you about such things.
-- 
        Michael Constant (mconst@soda.csua.berkeley.edu)


------------------------------

Date: 23 Apr 1997 03:54:21 -0700
From: mconst@soda.CSUA.Berkeley.EDU (Michael Constant)
Subject: Re: Last item in list is screwed
Message-Id: <5jkpot$pdt@soda.CSUA.Berkeley.EDU>

Marcus Nordenstam  <mnordenstam@imagicgames.com> wrote:
>@list = ("a\n","b\n");
>
>while( $l = <@list> )
>{
>  print $l;  
>} 

Careful, <@list> doesn't mean what you think it means.  In general,
you can't use <@list> to iterate over a list; it's only through an
unlikely coincidence that this rather plausible syntax actually works
in simple cases.

Let's look at an example that works:

    @list = (1, 2, 3);
    while (<@list>) {
	print "Got an element: $_\n";
    }

What's actually happening is this: <@list>, regardless of appearances,
is performing an ordinary filename glob.  But you can't glob a list,
only a string -- you normally use the globbing operator either as <*.c>
(specifying an explicit string to match) or as <${pattern}> (specifying
a scalar variable containing the string).  Since you used an array where
perl wants a string, it converts the array to a string the same way it
does in double quotes: it dumps all the elements together, seperated by
spaces (or the current value of $").

So if your list is (1, 2, 3), then perl will stringify that as "1 2 3",
and then pass that to csh to do globbing.  The csh glob function, given
a list of explicit filenames without metacharacters, just returns them
unmodified.  Perl then treats the returned string as an ordinary list
of filenames, and returns them one at a time just like normal.

Unfortunately, this all breaks down if the array elements contain any
characters that csh will find meaningful -- including spaces, newlines,
or even ordinary globbing characters like * or ?.  So at this point we
must sadly admit that the <@list> syntax only worked by chance, and
can't be expected to work in general.

As other posters have pointed out, you can easily do what you want with
foreach; see perlsyn(1) for more information.
-- 
        Michael Constant (mconst@soda.csua.berkeley.edu)


------------------------------

Date: Wed, 23 Apr 1997 07:44:30 GMT
From: "Steven D. Majewski" <sdm7g@virginia.edu>
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <AF83364A-1B615E@128.143.7.189>

On Sat, Apr 19, 1997 5:20 PM, John Ousterhout
<mailto:ouster@tcl.eng.sun.com> wrote:
>
>Let's take Lisp as an example.  I think that Lisp falls somewhere
>between scripting and system programming.  Many of you have suggested that
>it is an ideal language for both system programming and scripting, but I
>think that it isn't really very good for either.  In fact I suspect that
>this may be why Lisp hasn't been used much for practical programming.

[ ... ]

>Just to short-circuit the discussion that will ensue...
>
>I'm sure that many of you will argue against these claims ("my new
>version of Scheme is just as fast as C", "Lisp just needs a new garbage
>collector that embodies the latest techniques", "I know someone who
>combined C with Scheme and had no problems at all", etc.).  However,
>I've seen a fair amount of evidence on this and the problems far
>outnumber the success stories.  Many of the best minds in Computer
>Science have worked on Lisp over the last 30 years, and they haven't
>been able to fix the language so that it could be widely used either
>for system programming or scripting tasks.  This says to me that there
>is something fundamentally wrong with the language, at least for these
>tasks.
>


John -- your explaination is even worse that the original paper!

> In fact I suspect that this may be why Lisp hasn't been used 
> much for practical programming.

You throw in assertions like this with no mention of evidence or
a source for this conclusion. 

I'm using lisp for practical programming: statistics, graphics,
data-analysis,
converting foreign file formats. ( I'm not in comp. sci. -- I'm in the Med
school, so I'm not as interested in the elegant mathematics properties
of Lisp as the fact that it's an excellent tool. ). I know of lots of other
people using it for practical programming, including all of the people
doing statistics with XLispStat, all of the people writing applications 
and utilities in emacs lisp, and all of the people writing AutoCad
extensions
in lisp. 

What is the basis for statements about lisp not being widely used or about
the failure of Lisp ? 

It may be the case that there are more Tcl users than Lisp users, but I 
haven't seen even a poor attempt at a bad estimate made. Just the 
assertion that Tcl is a success and Lisp is a failure. 

How would you attempt to make such an estimate ? 

Number of downloads of software:
 Well, there are many download sites for Tcl. There are not only
many download sites for lisp, there are many different implementations
and there are also several different commercial implementations. 
And how do you rate embedded products. Many people get lisp in
autocad or emacs, but only a minority of users ever program it. How
does that count. Same problem with Tcl applications. 

Size and number of postings to usenet groups: 
Not reliable. Since there are more Lisp books and it's been around much
longer, maybe there aren't as many people asking questions on usenet. 
It may not be a valid sample. 

Number of books and articles published. 
 Lisp has the edge here. Tcl may be gaining. But it's still an
unlikely metric. 
 
Surveys: 
  There are sample and coverage problems with surveys. The few
 large scale surveys I've seen,  neither Lisp nor Tcl register as blips.
 They are burried in the "Other" catagory.  Real use may be better,
 as the coverage of some of those surveys would seem to be weighted
  towards larger ( more conservative?) organizations. 

If you have some evidence, then give it to us! [ I wish academic
Comp. Sci. were more interested in some practical basic questions
like that, but it's not an exciting project, and nobody is interested
in funding it. The same goes for some cross-language productivity
studies larger than making a button. These are things that would
take a lot of work, would have a clear scientific benefit, and are 
totally boring and unsexy research. ] 


Even if we do accept it likely that there are more Tcl than Lisp users:

[1] Is this a long term trend ? Computer Languages seem to follow
the same sort of trends and psychology that's been documented for
other technologies. There are early adopters who are looking for 
novelty, and there are the belt-and-suspenders crowd who will avoid
anything until it's time tested and proven. It's likely that there is 
a temporal pattern, and that Tcl is riding the crest, while Lisp is
at a steady state. When Tcl settles to it steady state, will it still 
have a large volume of users ? The novelty seekers may be onto
something new!

[2] Whatever the comparative volume for Lisp and Tcl, they are 
both clearly fighting it out with two dozen other languages for the
"other" category, left over after Cobol, Fortran, C, C++, Basic, 
and now probably Smalltalk and Java. If you are arguing success 
by popularity, you're on pretty shakey and not statistically significant
ground. 


I do think that Tcl has done several things right, and that Lisp
has done several things wrong. 
But after nearly 40 years, we can say without much doubt that
Lisp has been one of the great intellectual successes in computer
languages. Like - what was it, Algol 60 that this was said about ? -
It's a great improvement over most of it's successors. 

It would be unfair for me to ask where will Tcl be in 4o years.
I don't think that is the proper standard to apply. We're not
interested in posterity, but in practical tools now. But, I likewise
feel that judging Lisp by how many millionaries it may or may
not have created, compared to Basic or Unix is not the proper
standard for success or failure.  Lisp has been a success as an
idea and it's been a success as a tool, and it's got a more solid
track record in that regard than Tcl. I think there *was* a good
idea in that paper trying to get out, but this sort of thing does
more damage to your argument by undermining your credibility. 
I believe its more due to carelessness than to maliciousness,
but "careless with the truth" does not sound very complimentary. 


- Steve Majewski
<sdm7g@Virginia.EDU>


P.S. 
  I've used Tcl, and I can attest: 
 "The problems outnumber the  success stories." 





------------------------------

Date: Wed, 23 Apr 1997 13:43:07 +0100
From: cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer)
Subject: Re: Lisp is neither (was Re: Ousterhout and Tcl lost the plot)
Message-Id: <MPG.dc8066569804358989797@news.demon.co.uk>

With a mighty <AF833653-1B6390@128.143.7.189>,
sdm7g@virginia.edu uttered these wise words...

> If you have some evidence, then give it to us! [ I wish academic
> Comp. Sci. were more interested in some practical basic questions
> like that, but it's not an exciting project, and nobody is interested
> in funding it. The same goes for some cross-language productivity
> studies larger than making a button. These are things that would
> take a lot of work, would have a clear scientific benefit, and are 
> totally boring and unsexy research. ] 

This is why I recommend looking at Dylan, and the implementations:

http://www.harlequin.co.uk/full/dylan.html
http://legend.gwydion.cs.cmu.edu/gwydion/gwydion-overview.html

Gwydion looks like a research project for an industrial strength 
development system. Hardly a pure CS endeavour.

Perhaps this is close to what you're looking for? It could be used in 
a cross-language study, if such a thing were done. It could also make 
previous studies outdated. The state of the art is always changing.

Anyway, well said. Some of us using Lisp (or even more functional 
languages) are just looking for good tools. CS may have no more of an 
influence on our choice of Lisp than anyone chosing Tcl.

Followups set to comp.lang.dylan.
-- 
<URL:http://www.wildcard.demon.co.uk/> You can never browse enough
  Martin Rodgers | Programmer and Information Broker | London, UK
            Please note: my email address is gubbish.


------------------------------

Date: Wed, 23 Apr 1997 06:50:31 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Multiple Page Forms?????
Message-Id: <72tkj5.pt.ln@localhost>


jp (jp@here.com) wrote:

: You know what mistake you made. 

No I don't. 

Please explain how my answer was wrong. 

Help all the readers of c.l.p.m avoid whatever mistake you saw in it 
by pointing out _what_ that mistake was. 

You wouldn't want my mistake to be repeated, would you?

If not, then please explain to the readers what mistake should be avoided.


: If he thought he could do it another
: way he would not ask about perl, unless he needed to know about perl.

Huh?


: You attempted to chastise him and stated that it was not a perl
: question when it fact it was.  


I _did_ chatise him. No "attempt" about it.

Off topic posting is a chastisable offense  ;-)


: It might not be about modules, but then you did not say that.
           ^^^^^^^^^^^^^^^^^^^^

I DID say that.

Are you actually reading what I wrote?


: You were just unfriendly. The spirit of the Internet is to help.
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Yes it is.

I see from Dejanews that you sure have helped a lot. Thank you
for your contribution. I'm sure we all appreciate it.


: And now you want to embarress me in public ? 

I _don't_ want to embarrass you. I wouldn't need to anyway.

You're doing that just fine by yourself  ;-)


: no fool you ?

??


: If you don't like it, do something to change the name to
: comp.modules.perl (if you know what that means)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^

I hope you can excuse my denseness, but again, I don't know what that means.

Could you please explain it to me in more detail?


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Wed, 23 Apr 1997 10:58:45 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: need short script to replace txt file without fefreshing screen
Message-Id: <335DDD55.41C6@unl.ac.uk>

Otto F. Bauer wrote:
> 
> I'm new at this yet but with a little script that takes a get from html one
> text field and submit and writes the variable to a .txt file with out
> refreshing the html page at all.
> needs to be simple and complete with html.

What?  Can't you even produce the html??  Add this to an html doc:

<form method=POST action="process.pl.cgi">
<input name=text>
<input type=submit value="Submit">
<input name=reset value="Clear">
</form>

Some of this depends on how much of perl you have installed.  I think
cgi-handlers.pl is standard in
5.003 but maybe not.  You can't stop the browser behaving as if it is
initiating a download when the user
hits the submit button but if nothing is sent to the browser by the
script/server then a popup box will say
"Document contains no data" with its own cute little "OK" button to
click - actually I can't remember if
this will occur whether or not the script returns a Content-tye:
header.  Suck it and see.  It also depends
on how your CGI is configured.

<cackle>RATFM</cackle>

#! /usr/local/bin/perl

require 5.003;
use strict;

my (%rqpairs)

require cgi-handlers.pl;
&get_request;

if ($rqpairs{'text'}) {
    open (OUT, " >> data.dat");
    print OUT "$rqpairs{'text'}\n";
    close (OUT);
}

exit 0;

It's about that simple.

Alastair.


------------------------------

Date: 23 Apr 1997 08:26:39 +0200
From: Alessandro Forghieri <alf@orion.it>
Subject: Re: No GUI environment for Perl?
Message-Id: <m1g1wil0f4.fsf@aldebaran.orion.it>

nvp@shore.net (Nathan V. Patwardhan) writes:

> 
> elarishy@aol.com wrote:
> 
> What's wrong with keeping one MS-DOS window open with your editor buffer,
> and another for your command-line, from which you will run your Perl
> programs?  :-)

Not much, except a lot of people will not do it. The original post was talking
about *acceptance* not *feasibility*. 

Lots of people write what amount to 'Hello world' prgs in a graphic IDE
just because ithat makes things easier. Which sounds like a pretty good
reason to me ..

Cheers,
	ALessandro



-- 
'There's nothing like eating hay, when you're faint', he remarked to
her, as he munched away.  'I should think throwing cold water over you
would be better' Alice suggested 'or some sal-volatile' 'I didn't say
there was nothing *better*' the King replied 'I said there was nothing
*like* it'

Alessandro Forghieri              http://www.orion.it/~alf


------------------------------

Date: Wed, 23 Apr 1997 11:05:26 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: Odd array sizing information
Message-Id: <335DDEE6.641D@unl.ac.uk>

Dan Caugherty wrote:

> Hi!  I ran across what I believe to be a Perl bug.
> Given the following snippet:
> # --------------------------------------------
> # For sake of argument, assume $#some_array == 25
> @new_array = ();
> print $#some_array, "   ";
> for($i = 0; $i < $#some_array; $i++)
> {
>     push @new_array, $i;
> }
> print $#new_array, "\n";
> # ---------------------------------------------
> 
> I get:
> 
> 25   24
> 
> I would expect to get:
> 
> 25   25

I don't think it's a bug.  You forgot the last item in @some_array
because your second statement in the
for loop never equals $#some_array, it stops one short of that. Your
results are perfectly correct for the code you have written.

try this:

@new_array = ();
print $#some_array, "   ";
for($i = 0; $i <= $#some_array; $i++)
{
    push @new_array, $i;
}
print $#new_array, "\n";

Alastair.


------------------------------

Date: 23 Apr 1997 11:23:51 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl as its own metalanguage?
Message-Id: <5jkrg7$27g$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, michaeli@dra.com writes:
:Can you elaborate on this? In C++, at least, you can't overload based on
:return type. I'm having trouble thinking of a construct in C that would
:act differently based on a 'singular' or 'plural' context.

    int i = (1,2);
    int j[] = { 1, 2 };
    f(1,2);

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    I'll say it again for the logic impaired.
		--Larry Wall


------------------------------

Date: Wed, 23 Apr 1997 13:22:11 +0100
From: Alastair Aitken <a.aitken@unl.ac.uk>
Subject: Re: PERL Editor
Message-Id: <335DFEF3.3F89@unl.ac.uk>

Kyzer wrote:
> 
> Dick Barker of dickb@eskimo.com wrote in comp.lang.perl.misc:
> : Real perl programmers use cat >fname to write their stuff.
> Actually they use emacs.pl :)

I use twenty six half potatoes.  I'm working on puntuation now but kanji
scares the hell out of me :-)

vi anyone?

Alastair.


------------------------------

Date: 23 Apr 1997 10:13:30 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: perl NOT enabled???? win95 - MS server... Please help
Message-Id: <5jknca$s3h@info.abdn.ac.uk>

>From the lips of Nathan V. Patwardhan sprang:
: Kyzer (junkmail@sysa.abdn.ac.uk) wrote:

: : : Is there a program I have to install in the cgi-bin/scripts folder?
: : perl.exe :)

: Umm, no.  NEVER put perl.exe in the /cgi-bin directory.  Create 
: associations; edit the registry; install Linux, but don't put perl.exe
: there.

Thusly the smiley :)

http://www.idiot.net/cgi-bin/perl.exe%20-e%20"'rm -rf %7e'"

(no backtick on this mac - not my favourite perl editor :)

Of course, I am a devout Amigan, therefore all my perl cgi start
#!/ade/bin/perl

;)

--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac   |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com  |University or AUCC, thankfully.***** |always!
BEAU PEEP: This "Cow-man" comic of yours is riduiculous!
DENNIS: S'not!
BEAU: How is this "half-man, half-cow" supposed to catch criminals?
DENNIS: HE'S GOT LASER-BEAM UDDERS!



------------------------------

Date: 23 Apr 1997 10:04:33 GMT
From: junkmail@sysa.abdn.ac.uk (Kyzer)
Subject: Re: Perl/Cgi script
Message-Id: <5jkmrh$s3h@info.abdn.ac.uk>

>From the lips of Tom Phoenix sprang:
: On Mon, 21 Apr 1997 BBurns@Cbclegal.com wrote:

: > Why does my webserver eventually slow down since the addition of CGI
: > scripting (mainly multiple counter programs)???  

: It's probably busy executing them. :-)

: You might be able to improve the counter programs to make them run faster. 
: One way to speed things up would be to remove the counters altogether,
: since they're like the car counters you sometimes see at the side of the
: freeway. When was the last time you saw somebody stop to look at one of
: those? :-) 

No no no, the best way is to have a user counter server on one of the
host's ports. The counter CGI can then ask the server for a counter value,
and get on with it, while the server updates the count (locking appropriately,
of course)

My lovely counter-server is counting my - and many other user's - web pages,
at the address shown below.

--
Stuart 'Kyzer' Caie - Kyzer/CSG |undergraduate of Aberdeen University |100%
http://www.abdn.ac.uk/~u13sac   |My opinions aren't those of Aberdeen |Amiga -
kyzer@4u.net kyzer@hotmail.com  |University or AUCC, thankfully.***** |always!
This sig is under arrest! It has the right to remain silent!


------------------------------

Date: Wed, 23 Apr 1997 06:17:53 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Regular Expression Help Newbie
Message-Id: <15rkj5.rn.ln@localhost>

Deepak Thadani (deepak@pcsltd.com) 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.  


$value = $1 if /(^\d+)/;


: This is what I've got, which only seems to return
: the 1.
  ^^^^^

It returns *a* one, not *the* one. It will still return one if

$_ = "888     /usr/spool/mmdf/lock/home";
      ^^^ no ones in here!

The description for m// in the perlop man page says:

-----------------------
=item m/PATTERN/gimosx

=item /PATTERN/gimosx

Searches a string for a pattern match, and in a scalar context returns
true (1) or false ('').  If no string is specified via the C<=~> or
-----------------------

Says right there that it will return one...



: $VALUE = /[0-9]*\S\//;

: What I believe the above is doing is getting all the numbers until
: I get to a white space or / right?  Apparently wrong 


Nope. It is matching zero or more digits, followed by any character that
is NOT a white space, FOLLOWED (not 'or a slash') by a slash.


: since $VALUE
: after running that line, is simply 1.

Your pattern isn't matching what you said it matched, but that is
not why it is returning one. It is returning one because it matched
successfully.


: Please help...and explain how I can figure out reg exp's better if 
: possible.  Thanks a lot.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Wed, 23 Apr 1997 07:11:16 -0600
From: x@apocalypse.org
Subject: sendmail is stripping-out body of message with sendmail 8.7.4 - yowza!
Message-Id: <861797059.3713@dejanews.com>

We're using sendmail 8.7.4 on a Digital Unix 4.0A box and are having
a strange problem -

I've got a mailing list perl script I wrote which reads a list
of e-mail addresses, then sends an e-mail out to each of these
addresses. Sometimes, things work as expected, and the recipients
receive their e-mails with the body of the message intact. Other times,
internal users will receive the e-mail but the body of the message will
be blank... while users outside of our domain will receive the entire
message (w/intact body of the e-mail).

What might be causing this? I'm stumped. Sometimes it works, and sometimes
it don't (sic). Seems like the state of something else, which I don't
know about, must be coming into play. Internal users receive mail with
MS Mail and Exchange (blech)if that helps any.

Initially, I put a pause of about 20 seconds in-between e-mails so as to
not flood any mail queues. But recently, I'm not sure if that actually
did anything... when it *is* working... that is, when *all* users are
getting the body of the message, I'll slam one of the queues with 100
emails all sent at once with no pause, and they get delivered correctly.
Ugh. What else to check? Has anyone else ever experienced this odd
sendmail problem?


 Thanks!

  - Xochi (x@apocalypse.org)

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

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 352
*************************************

home help back first fref pref prev next nref lref last post