[6650] in Perl-Users-Digest
Perl-Users Digest, Issue: 275 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 10 23:17:20 1997
Date: Thu, 10 Apr 97 20:05:43 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 10 Apr 1997 Volume: 8 Number: 275
Today's topics:
Re: [Q] Unpack or split? (Eric Bohlman)
hard carriage return problem <jamesb@slip.net>
Re: Help on integer segmenting into an Array (Andrew M. Langmead)
Help with deleting from DBM file <q0c73@unb.ca>
Re: HELP: Need a little help on using PerlV5.003 with a <billc@tibinc.com>
Re: help: sort mangles array (Andrew M. Langmead)
IIS: Perl CGI's execing command line progs, can't read <gandalf@viman.com>
Re: lock file necessary? (Lutz Albers)
Math function <forster@hq.rnp.br>
Re: One for the Win 32 Perl and NT Gods (Matthew Cravit)
parsing a line w/ quoted strings (newbie) (Ken Irving)
Re: perl parsing slashing question <tchrist@mox.perl.com>
Re: Perl5 sin function has dain bramage ?!?!?!?!? <tibbs@hpc.uh.edu>
Re: Perl5 sin function has dain bramage ?!?!?!?!? (Eric Bohlman)
Re: problem with DB_File/DB_RECNO? <chuck@NYC.Thinkbank.COM>
Re: Regular expression help (Eric D. Friedman)
Re: Regular expression help (Eric Bohlman)
Re: Reply to Ousterhout's reply (was Re: Ousterhout and <erik@naggum.no>
Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Henry Baker)
Re: Reply to Ousterhout's reply (was Re: Ousterhout and (Charles Lin)
Re: system & variables in perl <critter@quack.kfu.com>
Re: Unix and ease of use (WAS: Who makes more ...) (Peter Seebach)
Re: Unix and ease of use (WAS: Who makes more ...) (jason olmsted)
Re: Unix and ease of use (WAS: Who makes more ...) (Ryurick M. Hristev)
Re: why can't arg 1 to shift be split? (David Alan Black)
Re: why can't arg 1 to shift be split? (Matthew Cravit)
Re: win32 perl problem ()
Re: Would like to test cgi-scripts offline. etta@none.net
Re: Would like to test cgi-scripts offline. <cbaron@nwrain.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 11 Apr 1997 02:27:03 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: [Q] Unpack or split?
Message-Id: <ebohlmanE8GC53.3Gu@netcom.com>
Michael S. Kerry (Michael.S.Kerry@hrb.com) wrote:
: I have fixed-length record data like the following:
: 12345 78901 3456 8 abcdefghijkl
: (a 5-digit number, a space, another 5-digit #, a space, a 4-digit #, a
: space, a 1-digit #, a space, a 12-character (unquoted) string).
: The numeric fields are pre-padded with zeros (if necessary) to maintain
: the record positioning (i.e., the forth value is always in position 18).
: What is the best (easiest? most reliable?) way to parse this record into
: the 5 fields (4 numeric, one string)? Unpack or split? The string might
: contain spaces (usually does, in fact...).
unpack is pretty much your only choice, since split assumes the presence
of separator characters or sequences. The presence of spaces shouldn't
bother unpack.
Definitely use unpack in preference to a bunch of substr extractions.
The problem with the latter is that if the length of any field other than
the last one gets changed, you'll need to change the values in *all* the
subsequent substr's, and it's almost certain that you'll be in a hurry
and miss one.
------------------------------
Date: Thu, 10 Apr 1997 18:07:55 -0700
From: James Bland <jamesb@slip.net>
Subject: hard carriage return problem
Message-Id: <334D8EEB.55A3@slip.net>
basically I'm trying to automate a few things eg.. changing passwords.
This requires the script to interact with the OS. I need something that
will send hard carriage returns after a print statement.
print ("$new_username") I tried \n but that is not interactive also
tried \r. any suggestions or maybe even a different path to follow. I
also want to make a autologin for telnet sessions using this script:
Thanks for any help
------------------------------
Date: Fri, 11 Apr 1997 00:11:31 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Help on integer segmenting into an Array
Message-Id: <E8G5v7.7qL@world.std.com>
Leon Stepanian <leonstep@cedep.com> writes:
>$hold could have any value from 1 - 4 digits long such as:
> 8 or
> 16 or
> 134 or
> 2567
How about:
@array = split //, sprintf '%04d', $input;
The printf converts the number into a string and pads it with zeros to
four characters. split // turns the string into an list of single
character elements.
--
Andrew Langmead
------------------------------
Date: Thu, 10 Apr 1997 15:27:06 -0300
From: Chowder <q0c73@unb.ca>
Subject: Help with deleting from DBM file
Message-Id: <Pine.SUN.3.96.970410151607.1332A-100000@jupiter>
I am keeping some info in a DBM file where each record has an expiration
date. My problem is that if I have several records in a row that need to
be deleted it seams that every time I delete one the next is skipped. (ie
if I had elements 1,2,3,4 and five to be deleted it only deletes 1,3,5 and
2,4 remain in the array). Here is what I have been doing:
while (($key, $fields) = each(%DBMFILE1)){
@arr = (split(/::/, $fields));
$expire = $arr[0];
(time < $expire)? print($fields) : delete ($DBMFILE1{$key});
}
Anyone see what I'm doing wrong?
Thanks for any help.
An e-mail reply would be appreciated.
q0c73@unb.ca
The Chowder King
------------------------------
Date: Thu, 10 Apr 1997 21:20:21 -0400
From: Bill Cowan <billc@tibinc.com>
To: Alex Sokol <Alex.Sokol@FMR.com>
Subject: Re: HELP: Need a little help on using PerlV5.003 with a Sybase stored procedure
Message-Id: <334D91D5.7662@tibinc.com>
James A. Robinson wrote:
>
> In article <33395393.C70@FMR.com>, Alex Sokol <Alex.Sokol@FMR.com> wrote:
> >Hi,
> > i'm trying to call a Sybase stored procedure which
> > makes a select and returns a value in the output
> > argument.
> >
> > Here is what i have:
> >
> > Stored procedure:
> > pr_get_busday @cur_bus_day output
> >
> > Perl script:
> > -- I'm using CTlib --
> > my(@cur_bus_day);
> > $sql_cmd = "exec pr_get_busday @cur_bus_day output";
^^^
Unfortunately for Perl users, the Sybase Transact-SQL syntax for local
variable is @variable (with leading at-sign).
To Perl, the "@cur_bus_day" is an array name that is being interpolated
into the SQL command string to execute the stored procedure. Try single
quoted string or backslash Sybase local variable ("\@cur_bus_day").
> > $dbh->ct_sql($sql_cmd);
^^^^^^
I have not looked closely at ct_sql() in CT-Lib module. But, in the
DB-Lib module, there were separate specific methods to handle stored
procedures, e.g. methods for output parameters, result sets, and return
status. You may need to re-code the above with the CT-Lib methods to
handle stored procedures.
> > print "Cur_bus_day: @cur_bus_day\n";
> > -- cur_bus_day appears to be null --
> > -- next_row loop also got me nothing --
>
> What I do is the following:
>
[SNIP]
> Jim Robinson <jim.robinson@stanford.edu> - http://highwire.stanford.edu/~jimr/
> HighWire Press -- Stanford University
-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com> Voice:919-490-0034 Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707
------------------------------
Date: Fri, 11 Apr 1997 00:06:17 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: help: sort mangles array
Message-Id: <E8G5MH.5D4@world.std.com>
nojunkmail@myaddress.com (Apple-O) writes:
>this code takes a 2-dimensional array $people of $count rows and $numkeys
>columns, sorts it by column $col and prints it out
How about if you sort it like this:
foreach $key ( sort { $people{$a}->[$col] cmp $people{$b}->[$col] }
keys %people) {
print "$key ", @{$people{$key}}, "\n";
}
>problem is array gets mangled during sort operation, records get repeated,
>some lost, etc.
Your method of pushing the sorted field and setting the sorted field
in a hash runs into problems when different records have identical data in
the sorting field.
--
Andrew Langmead
------------------------------
Date: 10 Apr 1997 17:14:45 -0700
From: Matt Cline <gandalf@viman.com>
Subject: IIS: Perl CGI's execing command line progs, can't read from pipe
Message-Id: <riohbmza8a.fsf@viman.com>
On IIS 2.0 under NT 4.0, using Hip Perl:
If I make a Perl script that does something like:
# Execute foo.pl, read ouput for command from PIPE.
open(PIPE,"perl foo.pl |");
while(<PIPE>) {
blah
blah
blah
}
close(PIPE);
I won't get any output from the command that I've executed (I can't
read anything out of the PIPE file handle) if I invoke this as a
CGI script under IIS; it works just fine if executed from the command
line or from other web servers.
foo.pl is:
# 'FOO!\n' should be read by invoking script
print "FOO!\n";
open(TEMP,">>C:/temp/foo.log");
print TEMP "BAR!\n";
close(TEMP);
I know that foo.pl is being executed, because the file 'C:/temp/foo.log'
is being created and written to, but as I said, I'm getting nothing
from it when I execute it using open(). Is there something I'm doing
wrong? Thanks for any help.
--
Matthew Cline |
gandalf@viman.com | Have you hugged your shoggoth today?
http://www.wyattriver.com/ | Microsoft happens
------------------------------
Date: Thu, 10 Apr 1997 10:27:15 +0200
From: lutz@muc.de (Lutz Albers)
Subject: Re: lock file necessary?
Message-Id: <lutz-ya023480001004971027150001@news>
In article <5igod7$l9f$1@news.iastate.edu>, mjd@plover.com (Mark-Jason
Dominus) wrote:
>[ Posix requires files open'd O_APPEND to seek-to-EOF before each write --mod ]
>
>>>>>>>> "MJD" == Mark-Jason Dominus <mjd@plover.com> writes:
>>MJD> Opening a file in append mode tells the kernel to atomically
>>MJD> seek to the end of the file immediately prior to *every* write.
>
>It still isn't safe, because it isn't atomic:
>
> Process 1: seek to end of file
> Process 2: seek to end of file
> Process 1: write at end of file
> Process 2: write at end of ... whoops...
Thats why there is a lock before using the file :-)
>Followups to comp.unix.programmer.
Followup & posting back to comp.lang.perl.misc. This is still relevant to perl.
ciao
lutz
--
Lutz Albers, lutz@muc.de
Do not take life too seriously, you will never get out of it alive.
------------------------------
Date: Thu, 10 Apr 1997 15:47:14 -0300
From: Antonio Paulo Salgado Forster <forster@hq.rnp.br>
Subject: Math function
Message-Id: <Pine.SOL.3.95.970410144002.18970A-100000@colibri.hq.rnp.br>
Hey folks!
I've been trying to evaluate a math function given by the user, but I have
no idea of how to do that...
the function would be in a variable and I would make a loop to get the
values do design a graph... I have thought of parsing the string using
stacks to interpretate the function, but I thought there might be a easier
way using Perl... any ideas?
TIA
--
Antonio Paulo Salgado Forster
Operacoes em Redes - RNP
------------------------------
Date: 10 Apr 1997 13:16:57 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: One for the Win 32 Perl and NT Gods
Message-Id: <5ijhrp$kl5@shell3.ba.best.com>
In article <5ijfe3$nc9@frontier.stoner.com>,
Mike Dudziak <mike.dudziak@stoner.com> wrote:
>When I click on the 'System' icon from the Control Panel I see
>the new updated values but they do not take effect until
>I click on 'OK' within the window.
That is correct; that's how WinNT works.
>I need a way for the new registry values to take immediate effect
>after the Perl Script changes them.
To the best of my knowledge, you can't. How and when WinNT reads the
registry is an NT thing, not a perl thing.
/MC
--
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Fri, 11 Apr 1997 02:33:16 GMT
From: systech@polarnet.com (Ken Irving)
Subject: parsing a line w/ quoted strings (newbie)
Message-Id: <4a7cd$112110.39@PolarNet>
I'd like to parse an input line
tag1=value1 tag2="a quoted string" tag3=value3
into the hash
tag1 => value1
tag2 => a quoted string
tag3 => value3
One way would be to replace whitespace between quotes with a special
value, delete the quotes, split on whitespace, then split on "=",
and finally restore the special value to whitespace. Is there an
easier way? Thanks.
--
Ken Irving
systech@polarnet.com
------------------------------
Date: 11 Apr 1997 02:02:08 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl parsing slashing question
Message-Id: <5ik630$sl1$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
ebohlman@netcom.com (Eric Bohlman) writes:
:David Alan Black (dblack@icarus.shu.edu) wrote:
:options, #!/usr/bin/perl -whip
Why do you guys what backup characters of `p'?
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
stab_val(stab)->str_nok = 1; /* what a wonderful hack! */
--Larry Wall in stab.c from the perl source code
------------------------------
Date: 10 Apr 1997 19:38:00 -0500
From: Jason L Tibbitts III <tibbs@hpc.uh.edu>
To: "David J. Topper" <topper@panix.com>
Subject: Re: Perl5 sin function has dain bramage ?!?!?!?!?
Message-Id: <ufaybaqpf6f.fsf@sina.hpc.uh.edu>
>>>>> "DJT" == David J Topper <topper@panix.com> writes:
DJT> sin(6.28318530717959) = -2.44929359829471e-16
In other words, zero to 15 places, which is closer than my HP48 gets. BTW,
6.28318530717959 isn't exactly 2*pi. Did you expect the result to be
exactly zero? I'd be worried if it was.
DJT> sin(360) = 0.958915723414307
Which is accurate to as many places as my HP48 will generate.
sin takes its argument in radians.
DJT> What the hell is going on ?!?!?!?!?
Floating point math, perhaps? Or maybe a lack of understanding thereof?
--
Jason L. Tibbitts III - tibbs@uh.edu - 713/743-8684 - 221SR1
System Manager: University of Houston High Performance Computing Center
1994 PC800 "Kuroneko" DoD# 1723
------------------------------
Date: Fri, 11 Apr 1997 02:39:38 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl5 sin function has dain bramage ?!?!?!?!?
Message-Id: <ebohlmanE8GCq2.44z@netcom.com>
David J. Topper (topper@panix.com) wrote:
: I've been killing myself trying to figure out what values
: I'm getting for the sin function. Here's my code:
: #!/usr/local/bin/perl5 -w
: $pi = atan2(1,1) * 4;
: $tpi = 2*$pi;
[snip]
: and my output is:
: sin(6.28318530717959) = -2.44929359829471e-16
: sin(360) = 0.958915723414307
: What the hell is going on ?!?!?!?!?
In your first case, you're seeing roundoff error; that value is extremely
close to 0 (if written in decimal notation, it would have fifteen zeroes
to the right of the decimal point). In your second case, you're trying
to pass an angle in degrees, but sin() is expecting it in radians.
Divide your degrees by $tpi to convert them to radians.
------------------------------
Date: Thu, 10 Apr 1997 20:31:16 -0400
From: Chuck Ocheret <chuck@NYC.Thinkbank.COM>
Subject: Re: problem with DB_File/DB_RECNO?
Message-Id: <334D8654.7B48@NYC.Thinkbank.COM>
I recently wrote:
>
> I can't seem to get the DB_RECNO type of DB_File tie to work properly.
>
> Basically push seems to have no effect and Perl seems to lose track of
> the length of arrays tied this way....
Here is the excellent response I got from Paul Marquess...
>From pmarquess@claudius.bfsec.bt.co.uk Thu Apr 10 04:57:42 1997
>
>...
>
>let me draw your attention to the perltie manual page:
>
> WARNING: Tied arrays are incomplete. They are also distinctly
> lacking something for the $#ARRAY access (which is hard, as it's an
> lvalue), as well as the other obvious array functions, like push(),
> pop(), shift(), unshift(), and splice().
>
>I have included push/pop etc equvalent methods with DB_File to get
>around this limitation. I don't think they were documented the DB_File
>that came with 5.003, the latest development release 5.003_97 does
>though.
>
>Here is an example from the latest DB_File of using the methods.
>
> use strict ;
> use vars qw(@h $H $file $i) ;
> use DB_File ;
> use Fcntl ;
>
> $file = "text" ;
>
> unlink $file ;
>
> $H = tie @h, "DB_File", $file, O_RDWR|O_CREAT, 0640, $DB_RECNO
> or die "Cannot open file $file: $!\n" ;
>
> # first create a text file to play with
> $h[0] = "zero" ;
> $h[1] = "one" ;
> $h[2] = "two" ;
> $h[3] = "three" ;
> $h[4] = "four" ;
>
> # Print the records in order.
> #
> # The length method is needed here because evaluating a tied
> # array in a scalar context does not return the number of
> # elements in the array.
>
> print "\nORIGINAL\n" ;
> foreach $i (0 .. $H->length - 1) {
> print "$i: $h[$i]\n" ;
> }
>
> # use the push & pop methods
> $a = $H->pop ;
> $H->push("last") ;
> print "\nThe last record was [$a]\n" ;
>
> # and the shift & unshift methods
> $a = $H->shift ;
> $H->unshift("first") ;
> print "The first record was [$a]\n" ;
>
> # Use the API to add a new record after record 2.
> $i = 2 ;
> $H->put($i, "Newbie", R_IAFTER) ;
>
> # and a new record before record 1.
> $i = 1 ;
> $H->put($i, "New One", R_IBEFORE) ;
>
> # delete record 3
> $H->del(3) ;
>
> # now print the records in reverse order
> print "\nREVERSE\n" ;
> for ($i = $H->length - 1 ; $i >= 0 ; -- $i)
> { print "$i: $h[$i]\n" }
>
> # same again, but use the API functions instead
> print "\nREVERSE again\n" ;
> my ($s, $k, $v) = (0, 0, 0) ;
> for ($s = $H->seq($k, $v, R_LAST) ;
> $s == 0 ;
> $s = $H->seq($k, $v, R_PREV))
> { print "$k: $v\n" }
>
> undef $H ;
> untie @h ;
>
> use DB_File ;
>
>Paul
Thanks, Paul!
~chuck
Chuck Ocheret ---------------------------------- chuck@NYC.Thinkbank.COM
Thinkbank, Inc. http://www.Thinkbank.COM/
648 Central Park Avenue, Suite 248 +1 (914) 722-0245 [voice]
Scarsdale, NY 10583 +1 (914) 722-0249 [fax]
------------------------------
Date: 11 Apr 1997 00:20:52 GMT
From: friedman@medusa.acs.uci.edu (Eric D. Friedman)
Subject: Re: Regular expression help
Message-Id: <5ik054$e13@news.service.uci.edu>
[mailed, posted]
In article <334D6CF9.277A6A54@csulb.edu>, <roehnelt@csulb.edu> wrote:
>The end of this line ends with an _is_ I know the i stands for case
>incensitive, but I couldn't find anything telling me what the s does.
>
>while ( $content =~ s#<\s*img.*?alt\s*=\s*"(.*?)".*?>#$1#is ) {}
>
>any help would be appreciated.
Don't they have man pages at Cal State Long Beach? What are
my tax dollars going for? :-)
man perlre
PERLRE(1) Perl Programmers Reference Guide PERLRE(1)
NAME
perlre - Perl regular expressions
DESCRIPTION
This page describes the syntax of regular expressions in
Perl. For a description of how to actually use regular
expressions in matching operations, plus various examples of
the same, see m// and s/// in the perlop manpage.
The matching operations can have various modifiers, some of
which relate to the interpretation of the regular expression
inside. These are:
i Do case-insensitive pattern matching.
m Treat string as multiple lines.
s Treat string as single line.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
How hard was that?
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Fri, 11 Apr 1997 02:33:55 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Regular expression help
Message-Id: <ebohlmanE8GCGJ.3vF@netcom.com>
roehnelt@csulb.edu wrote:
: The end of this line ends with an _is_ I know the i stands for case
: incensitive, but I couldn't find anything telling me what the s does.
: while ( $content =~ s#<\s*img.*?alt\s*=\s*"(.*?)".*?>#$1#is ) {}
It's described in detail on P.67 of the Camel book. What it does is allows
your ".*" constructs to match across line boundaries (normally "."
matches any character except a newline).
------------------------------
Date: 10 Apr 1997 17:20:42 +0000
From: Erik Naggum <erik@naggum.no>
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <3069681642982192@naggum.no>
| [posted and mailed]
the header "mail-copies-to: never" was supposed to discourage discourtesy
copies. if you wish to be kind and helpful, wait for people to ask you
mail them copies before you do it. otherwise, you just bother them
needlessly. receiving this gunk of yours twice has not helped, either.
* Erik Naggum
| languages have more than one implementation. perl doesn't. does Tcl?
* Douglas Seay
| If I understand you correctly, you are saying that the definition of a
| language (as opposed to a tool) is multiple implementations?
I cannot fathom how you could draw that conclusion from what I wrote, but
since you would have asked how I define languages to the exclusion of mere
tools if you were able to recognize when you overstep your understanding:
languages exhibit the property that they have more than one implementation.
languages exhibit the _defining_ property that there is a specification of
the syntax, semantics, etc, apart from any implementation; or, briefly,
that specification is superior in importance to implementation. tools
exhibit the property that their input or control languages are inferior in
importance to the implementation and thus subject to change according as
changes to the implementation are deemed necessary.
| This might be ancient history, but was there a formal specification of
| COBOL, FORTRAN or APL before the first implementation?
no, languages didn't evolve ex nihilo in ancient history. that's a trait
of modern languages. languages naturally evolve from useful tools with
user experience. one reason to favor a language specification over just
the implementation is that more programmers can take part in the language
design process than just the colleagues of the designer, the merits of the
design can be discussed outside of the scope of the implementation, the
specification can be a source of much-needed stability as implementations
grow, bugs in the implementation can be bugs in the implementation instead
of random "features", etc.
the rest of your article is below the threshold of hopelessly stupid.
#\Erik
--
I'm no longer young enough to know everything.
------------------------------
Date: Fri, 11 Apr 1997 03:04:15 GMT
From: hbaker@netcom.com (Henry Baker)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <hbaker-1004971904150001@10.0.2.1>
In article <5ijh3u$qsn$1@hawk.branch.com>, scs@iti.org (Steve Simmons) wrote:
> Lisp has suffered (as has UNIX) by being grossly oversold by it's
> proponents. On close examination, the proponents of both have confused
> the environment (libraries, debuggers, UIs, rich set of tools and
> utilities) with the thing itself. This was brought home quite
> forcefully when, after incessant badgering from some lispaholics who
> refused to give up their (admittedly very nice) TI lisp machines, I
> built and installed lisp on UNIX for them. They wouldn't use it,
> because all the other things they had (which were in lisp, according to
> them) weren't available under UNIX.
You make a good point about the importance of environments. That's precisely
the advantage of Lisp. You get a uniform picture of the world -- everything
is Lisp. You don't have to know anything about machine language, assemblers,
linkers, and all plethora of itty bitty 'tools' with <3-character names.
You have the same language for writing macros, the same language for writing
system code, the same language for writing scripts, the same language for
writing editor extensions, the same language for interacting with windows,
etc.
Now some would consider this sameness a negative, and with most languages it
would be. But with the power of Lisp as an ubiquitous extension language, I
don't have to memorize all sorts of 'special-purpose languages', each with
different syntax, different naming conventions, different shadowing semantics,
different versions of ifthenelse, dowhile, etc.
Lisp is the ultimate 'fractal' language, because it is good at all levels,
from microcode to shell scripts.
------------------------------
Date: 11 Apr 1997 02:18:04 GMT
From: clin@cs.umd.edu (Charles Lin)
Subject: Re: Reply to Ousterhout's reply (was Re: Ousterhout and Tcl ...)
Message-Id: <5ik70s$ai1@mimsy.cs.umd.edu>
Steve Simmons (scs@iti.org) wrote:
|| [[ An aside -- yes, there are languages where it's difficult to build
|| good libraries. That's not my point. My point is that if you want
|| to talk about the relative features of various languages, talk about
|| the features -- not the libraries, or the debuggers, or anything
|| except the language itself. ]]
While perhaps the only fair way to talk about one language vs. another
is to talk about the language itself, most people use a given language
because of the support is has, and that means libraries, debuggers, and
so forth. If a language doesn't have this kind of support, then people
presumably are going to be far less likely to use it, even if it is
a nicer language when those factors are ignored.
--
Charles Lin
clin@cs.umd.edu
------------------------------
Date: Thu, 10 Apr 1997 18:11:34 -0700
From: "Charles F. Ritter" <critter@quack.kfu.com>
Subject: Re: system & variables in perl
Message-Id: <334D8FC6.7E27F1CC@quack.kfu.com>
nicholas david pesce wrote:
>
> I am trying to write a program that will check to see if anyone is on my
> machine inside a network...
> Thus I want to use the unix who command and translate the output into
> an array that can be checked for my username, and that it is on the console
> I understand that this is a simple program but I am having problems transfering
> the system("who") data into a perl array, could someone help a newbie out on
> this problem.
>
> Thanks
>
> -Nick
> pesce@cis.ohio-state.edu
This will read your 'who' into scalars. If all you want to do is check
for "you" on the console you don't need an array: the while loop
iterates over the record by record data return from 'who'.
#!/usr/bin/perl -w
open (WHO,"who |") or die "something is terribly wrong!";
while(<WHO>) {
( $user, $tty, $month, $day, $time, $location) = split;
print "$user\t$tty\t$month\t$day\t$time\t$location\n";
print "you win!\n" if ( $user eq "you" && $location eq "(0.0)" )
}
Pretty cool eh.
--
Charles Ritter
Microsoft NT - when they are finally finished it will be the best
documented unix operating system on the market, but you'll pay extra.
------------------------------
Date: 10 Apr 1997 18:15:09 -0500
From: seebs@solutions.solon.com (Peter Seebach)
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <5ijs9t$f9h@solutions.solon.com>
In article <01bc45c0$691ee100$87ee6fce@timpent.a-sis.com>,
Tim Behrendsen <tim@a-sis.com> wrote:
>> What is the base line for "hugely complex" then?
>Well, hard to measure these things of course, but let's say above the
>100K-200K lines of code range.
What, to be considered important a program has to be badly organized and
involve a lot of duplication of existing work?
>Perl4 is 33800 LOC (including comments, blank lines, etc), and Perl5
>is 51718.
Let's be fair; a LOC in C is worth a typical 3-5 LOC in assembly, certainly at
least 3; likewise, a LOC of perl is worth at least 3-5 LOC in C, certainly at
least 3, probably more like 8-10, because the basic operators are higher level
and a lot of functionality (growing arrays, etc.) is silently handled....
How many lines of additional library support does perl5 include, which were
written in perl? Quite a few... and I bet they weigh in as at least 5 times
their weight in equivalent functionality written in C.
Hmm. I show about 22kLOC of perl5 library support which is legitimately part
of the language; I'd estimate that alone as roughly 100kLOC worth of C,
probably more.
-s
--
Copyright 1997 Peter Seebach - seebs at solon.com - C/Unix Wizard
I am not actually gladys@nancynet.com but junk mail is accepted there.
The *other* C FAQ, the hacker FAQ, et al. http://www.solon.com/~seebs
Unsolicited email (junk mail and ads) is unwelcome, and will be billed for.
------------------------------
Date: 11 Apr 1997 00:29:49 GMT
From: olmstj@phat-media.com (jason olmsted)
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <5ik0lt$cjq$2@news9.gte.net>
On Thu, 10 Apr 97 21:41:15 GMT, tomw@tsys.demon.co.uk (Tom Wheeley)
wrote:
>In article <5ij03s$509$5@news13.gte.net>
> olmstj@phat-media.com "jason olmsted" writes:
>
>>
>>
>> >"Tim Behrendsen" <tim@a-sis.com> writes:
>> >
>> >> But I don't even need to go there. Name one freely available
>> >> *significant* product that is *clearly* better than *any* commercial
>> >> product, regardless of price. There are some good programs of limited
>> >> size that are not worth a commercial entity rewriting (some may
>> >> say Emacs, but I wouldn't...), but I mean products of significant
>> >> size and complexity.
>> >
>> >TeX
>>
>> I don't share the belief, but a fair number of people believe
>> Microsoft Internet Explorer is a superior product to Netscape
>> Navigator.
>>
>> Mind you, these people must not care about security or platform
>> consistency, but there it is, a "free" product that is on par with a
>> commercial one (though who knows how much we'll pay for it in the end)
>
>MSIE is ***not*** a free product. It is a commercial product dumped on the
>market by Microsoft to attempt to gain control of how people see the
>internet.
>
>--
>:sb)
>
I don't mean to be rude, but if they license it to me at no cost to
me, then it is free. If they take a loss in the process, hey, that's
their problem. If they have a sinister plot behind it, hey that's
something else altogether. Right now, there are no restrictions of
use except for the State Department guidelines for blocking export to
certain nation-states.
I won't let my lack of love for Microsoft cloud my logic. Freeware
means freely distributed software and MSIE falls in that class.
jason olmsted
olmstj@phat-media.com
http://www.phat-media.com/olm
------------------------------
Date: 11 Apr 1997 11:14:15 +1200
From: physrmh@ANTISPAMphys.canterbury.ac.nz (Ryurick M. Hristev)
Subject: Re: Unix and ease of use (WAS: Who makes more ...)
Message-Id: <qv6enci79o8.fsf@ANTISPAMphys.canterbury.ac.nz>
les@MCS.COM (Leslie Mikesell) writes:
> In article <3342473A.794B@ic.ac.uk>, Gavin Tabor <gavin@ic.ac.uk> wrote:
> >Terry Reedy wrote:
> >>
[...]
> >> NO! freeware is voluntary activity
[...]
> >NO! freeware is communism
I think that for most freeware *writers* (not *commentators* ;)
freeware is either hobby or research.
I would suspect that even RMS while trying to make a (more or less)
political statement, have done what have done for love of computers,
from hacker to hacker (to not be confused with the word cracker).
Cheers,
--
Delete ANTISPAM to reply. Apologies for inconvenience. (Spam,Grrrrr :)
______________________________________________________________________
Ryurick M. Hristev ()..()/^\/^\ -<:-)
physrmh@ANTISPAMphys.canterbury.ac.nz \/ \#/\#/\) What opinions ?
______________________________________________________________________
------------------------------
Date: 11 Apr 1997 00:06:42 GMT
From: dblack@icarus.shu.edu (David Alan Black)
Subject: Re: why can't arg 1 to shift be split?
Message-Id: <5ijvai$qik@pirate.shu.edu>
ebohlman@netcom.com (Eric Bohlman) writes:
>Mathew A. Hennessy (hennessy@cloud9.net) wrote:
>: I want to do this:
>: require perl5;
>: $user_name=shift( (split(/:/,$htpasswd_line)) );
>: However, I get this in reply:
>: Type of arg 1 to shift must be array (not split) at build-user_info.pl
>: line 35, near ") )"
>: Execution of build-user_info.pl aborted due to compilation errors.
>: And, this works, but is extremely inelegant (IMHO):
>: require perl5;
>: @crud=split(/:/,$htpasswd_line);
>: $user_name=shift(@crud);
>: Now, what I am interested in knowing is if split returns a
>: "second-class" list of some kind.. Why can't I shift the list returned
>: by split? I'm not used to Perl telling me I _must_ do _anything_..
>split doesn't return an lvalue, so you can't assign to it, and shift
>involves an assignment.
>What's wrong with
>$user_name=(split(/:/,$htpasswd_line))[0];
>?
Or, if you must use shift:
$user_name = shift ( @{[split ":", $htpasswd_line]} );
But I like Eric's better :-)
David Black
dblack@icarus.shu.edu
------------------------------
Date: 10 Apr 1997 13:11:50 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: why can't arg 1 to shift be split?
Message-Id: <5ijhi6$jts@shell3.ba.best.com>
In article <5ija6q$4dc@cloud9.net>,
Mathew A. Hennessy <hennessy@cloud9.net> wrote:
> checked perlfunc,perlfaq4, no answer..
>
>I want to do this:
> require perl5;
>
> $user_name=shift( (split(/:/,$htpasswd_line)) );
You could achieve the same effect with:
$user_name = (split(/:/, $line))[0];
I'm not sure precisely why the example you gave doesn't work; my guess would
be that it has something to do with the shift not being able to tell if
split is returning a list or a scalar. That's only a guess, though.
/MC
--
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: 10 Apr 1997 19:02:36 GMT
From: scott@lighthouse.softbase.com ()
Subject: Re: win32 perl problem
Message-Id: <5ijdgc$qp0$1@mainsrv.main.nc.us>
Levi Stamper (stamper@cybercash.com) wrote:
: I am using the w32 version of perl on NT4.0 (shipped with NT reskit),
: and can't get the simplest of things to work..
: how can I read command-line arguements? @ARGV[0] doesn't point to
: anything...this works on every other platform I've tried it on.
It largely depends on how you call the program. How are you
calling the program? If you associate .pl with the perl interpreter,
remember you need %1 through %9 to pass along arguments to the
script via the interpreter.
It could, since you're using "@ARGV[0]" instead of $ARGV[0], be
a user error. The fact that it worked on every other platform
could be a side effect of unspecified behavior!
: <stamper@cybercash.com>
^^^^^^^^^
If this is who is working on e-commerce, I'm hanging on to my
checkbook.
Scott
------------------------------
Date: Fri, 11 Apr 1997 00:26:40 GMT
From: etta@none.net
Subject: Re: Would like to test cgi-scripts offline.
Message-Id: <334d851c.236635309@netnews.worldnet.att.net>
Try ohttpd or fnord there both win95 servers and there free.
ohttpd installs it self and there nothing you have to configure. All
you have to do is tell it where perl.exe is.
You can find them both on http://www.tucsow.com
Hope this helps,
etta
On Thu, 10 Apr 1997 21:46:08 GMT, exet0068@sable.ox.ac.uk (Joe
Wickremasinghe) wrote:
>
>Rather than log on to my ISP and waste money while I try to figure out
>cg scripting, is there any way I can run perl programs. , as cgi
>scripts, while offline? I would imagine this may involve setting up my
>computer as a web server, even though no-one else is going to connect
>to it. I am thinking of installing Linux - perhaps it would be easier
>under this than Win95?
>
>Thanks,
>
>Joe Wickremasinghe
------------------------------
Date: Thu, 10 Apr 1997 17:58:26 -0700
From: Chris Baron <cbaron@nwrain.com>
Subject: Re: Would like to test cgi-scripts offline.
Message-Id: <334D8CB2.5A42@nwrain.com>
Joe Wickremasinghe wrote:
>
> Rather than log on to my ISP and waste money while I try to figure out
> cg scripting, is there any way I can run perl programs. , as cgi
> scripts, while offline? I would imagine this may involve setting up my
> computer as a web server, even though no-one else is going to connect
> to it. I am thinking of installing Linux - perhaps it would be easier
> under this than Win95?
>
> Thanks,
>
> Joe Wickremasinghe
Install Linux, Perl, and run Apache or some other server. I've used a
set up like this for over a year and it works great. You can even
duplicate your username and ISP's directory structure for a very close
environment duplication.
I use RedHat Linux, it comes with Perl 5.003 and Apache 1.1.1
pre-installed and all set up to run in the default setup. Works like a
champ.
--
Chris Baron - Technical Director at
/ | T H E / / /
(___| ___ ___ ___ (___ ___ ___ ___
| )\ )| )|___)| )| | |___ | | )| )
| / \_/ |__/ |__ | |__ | __/ | | / |__/
/ | N E T W O R K __/
chris@hypertising.com - http://www.hypertising.com/
Look for my new book "Drag n Drop CGI -
Enhancing your web site without programming"
from Addison-Wesley Developer's Press - mid '97
------------------------------
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 275
*************************************