[7858] in Perl-Users-Digest
Perl-Users Digest, Issue: 1483 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 16 13:07:28 1997
Date: Tue, 16 Dec 97 10:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 16 Dec 1997 Volume: 8 Number: 1483
Today's topics:
Re: Advice on References to Class Functions ? <mbennett@ideaeng.com>
Re: compacting array (Figured it out) <NerveGas@nospam.com>
foreach && references <justinb@cray.com>
Re: foreach && references <tycage@infi.net>
Re: HELP - Bulkmail - Does anyone know how to do it? (Sitaram Chamarty)
help decode a pattern <milab@nortel.ca>
Re: How to stop 'read' from waiting for ever in perl v5 <rra@stanford.edu>
Is anything like this wonderful script available to dow cpickles@yahoo.com
Re: Kerberos authentication <rra@stanford.edu>
Re: Looking to work with Perl for Master's Thesis <rra@stanford.edu>
Re: NEED: Fast, Fast string trim() (Tony Bowden)
Re: newbie = ? on executing OS/2 commands via system(), <koos_pol@bigfoot.com>
Re: newbie file input question <phurd@teleport.com>
Re: newbie file input question <phurd@teleport.com>
Re: Newbie question. (M.J.T. Guy)
Re: Newbie question. peter.edlund@capgemini.se
Re: Newbie question. <reibert@mystech.com>
Re: pgp encrypion via perl script <rra@stanford.edu>
Re: Please advise. Fastest way to line-count files <NerveGas@nospam.com>
Re: rindex ? (Mike Stok)
Re: rindex ? <rra@stanford.edu>
Re: Teaching programing <Jacqui.Caren@ig.co.uk>
Re: Teaching programing <rra@stanford.edu>
Re: Using Excel95 with Perl (Michel Dalle)
What's your favorite UNIX pl-db? (Brad Johnson)
Re: Why does my suid program have /dev/fd/3 in $0 <rra@stanford.edu>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 16 Dec 1997 09:20:26 -0800
From: "Mark L. Bennett" <mbennett@ideaeng.com>
Subject: Re: Advice on References to Class Functions ?
Message-Id: <3496B852.64EF@ideaeng.com>
Andrew M. Langmead wrote:
>
> "Mark L. Bennett" <mbennett@ideaeng.com> writes:
>
> >I will call Traverse, and pass it a reference to a function.
> >I will call the Traverse fuction with a Node (or NamedNode)
> >reference, and a reference to a small fucntion to process
> >each node.
>
> How about if you pass a string containing the name of the method you
> want to call (lets say we store it in a variable called $method), and
> say:
>
> $node->$method();
>
> to call it?
> --
> Andrew Langmead
An interesting idea.
I had started down that path yesterday, but I had syntax
problems because my function needed to take arguments.
I think the trick is to build a string that uses a the method
name as a string, and includes the arguments, and then use
the eval() function. I think that will work.
However, I can't feeling that this is "lame". I used to write
self modifying macros in 20/20 and Lotus back in the 80's, to
workaround those macro language limitations, and I remember
thinking how lame that was as well.
But this is probably good enough for now. I'm curious to see
if anyone else has any comments.
Thanks,
Mark
------------------------------
Date: Tue, 16 Dec 1997 09:39:24 -0700
From: NerveGas <NerveGas@nospam.com>
Subject: Re: compacting array (Figured it out)
Message-Id: <3496AEBC.6682@nospam.com>
OK, the original question was whether it was possible to compact
null entries from an array without creating a secondary array. Several
posts were made such as:
@a = grep $_ != 0, @a;
Which does create a second "temporary" array. I figured out how to do
it without creating a secondary array, which will save a lot of memory
if you are sorting large arrays.
I know it's not elegant, I know you'd probably all do it differently.
And you can tell I'm used to C. : ) Here it is:
$last_good=0;
for ($loop=0;$loop<@array;$loop++){
if ($array[$loop]){
$array[$last_good]=$array[$loop];
undef($array[$loop]) if ($loop!=$last_good);
$last_good++;
}
}
That will only use a temporary storage space as large as the largest
single element in your array, which will usually be much, much smaller
than the array itself. It will also undef() the "extra" entries after
compacting.
Steve (NerveGas)
------------------------------
Date: 16 Dec 1997 10:57:00 -0600
From: Justin Banks <justinb@cray.com>
Subject: foreach && references
Message-Id: <o8n4t49i5ur.fsf@ebony.cray.com>
Hello -
I can't see why the following two snippets execute differently.
I'm sure that it's something simple, but I can't see it.
$a = "one: two:three:four:five";
($junk, @b) = (split ':', $a);
$c{test} = \@b;
foreach $d (@$c{test}) {
print "$d\n";
}
Prints nothing.
$a = "one: two:three:four:five";
($junk, @b) = (split ':', $a);
$b = \@b;
$c{test} = $b;
foreach $d (@$b) {
print "$d\n";
}
Prints :
two
three
four
five
--
Justin Banks \ if the answer is the same whether you're programming
Silicon Graphics \ in Perl, C, or Visual Modula 17++ with JavaBeans and
Eagan, Minnesota \ Digital Satellite TV Support, it's not a Perl question.
------------------------------
Date: Tue, 16 Dec 1997 12:39:19 -0500
From: Ty Cage Warren <tycage@infi.net>
Subject: Re: foreach && references
Message-Id: <3496BCC7.717AF5E2@infi.net>
Justin Banks wrote:
First a tip, did you run your script with -w ?
It gave a clue to the problem.
> Hello -
> I can't see why the following two snippets execute differently.
> I'm sure that it's something simple, but I can't see it.
>
> $a = "one: two:three:four:five";
> ($junk, @b) = (split ':', $a);
> $c{test} = \@b;
> foreach $d (@$c{test}) {
The problem is the precedence in this line. You need to write it like
this.
foreach $d (@{$c{test}}) {
print "$d\n";
}
Then you'll get what you expect.
I'm pretty sure (anyone what to confirm this for me?) that your way is
evaluating it as {@$c}{{test}} i.e. it's trying to dereference $c to an
array and then take
a hash slice from it, since $c isn't defined, $d is getting undef stuck
into it
once, which it then prints followed by a newline. Running the script
with -w
would have warned you about the uninitialized value i.e.
Use of uninitialized value at ./work.pl line 7.
> print "$d\n";
> }
> Prints nothing.
Like I said above, it does print something
undef\n
which looks just like a blank line.
Hope this helps.
Ty
+---+
Ty Cage Warren tycage@infi.net
Systems Engineer InfiNet
The Web Site of Love: http://www.wsol.net/mst3k/
PGP Public Key: http://www.wsol.net/~tycage/pgpkey.html
PGP Fingerprint: FF C1 28 CA 80 B5 31 78 B1 24 2E 8C AB DA FB D2
------------->Never invoke anything bigger than your head.<-------------
------------------------------
Date: 16 Dec 1997 15:44:24 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: HELP - Bulkmail - Does anyone know how to do it?
Message-Id: <slrn69b028.ki.sitaram@ltusitaram.diac.com>
On Sun, 14 Dec 1997 13:20:35 GMT, Bart Lateur <bart.mediamind@tornado.be> wrote:
>hector@csgm.com (hector Catre) wrote:
>
>>I've been given a text based database of over 12,000 e-mails
[snip]
>You're trying to send the bulk e-mail in a CGI script, right? Well, you
>should close the communication with the browser, by "closing" STDIN and
>STDOUT. See Randal's Webtechniques, Column 20 for some nifty ideas.
...and while you're about it, post the domain name from which you're going to
be doing this. I'd like to add it to my filters!
------------------------------
Date: Tue, 16 Dec 1997 12:17:28 -0500
From: terminator <milab@nortel.ca>
Subject: help decode a pattern
Message-Id: <3496B7A8.B0D@nortel.ca>
could someone interpret the expression below for me.
$alines=~ /^\[([^\]]*)\]/
^^^^^^
i can make some sense of it, but i need to know what it does
specifically. i think it will match a word starting with '[' and
ending with ']', and save it in $1. but i don't know how the
implementation [^\]]* is interpreted. could someone post the
interpretation.
Thanks,
Parampreet
------------------------------
Date: 16 Dec 1997 08:26:16 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: How to stop 'read' from waiting for ever in perl v5.004
Message-Id: <m3yb1ljluf.fsf@windlord.Stanford.EDU>
Dafydd Richards <dafydd@gwe.co.uk> writes:
[...]
> while($cond==1) {
> read(FILE,$buffer,200);
> }
[...]
> The point of doing this is that after 3 seconds the alarm breaks the
> read and jumps into the loop again with $cond=0 and therefore breaks the
> loop. In perl version 5.004 the function 'timeup' seems to return to
> the 'read'.
> Is there anyway in perl 5.004 of breaking the wait on 'read' after a set
> time???
Can you simply close FILE?
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 16 Dec 1997 17:30:41 GMT
From: cpickles@yahoo.com
Subject: Is anything like this wonderful script available to download from the web?
Message-Id: <3496ba0b.92719303@news.demon.co.uk>
Hiya Guys,
I was surfing the net and came across one of the best uses of CGI I
have ever seen at:
http://www.channel4.com/right_to_reply/forum/
The right to reply forum, its just like newsgroups (I really DO like
the three frame look) is anything like this available to download
from the web (like from selena sols type archive) I have seen the
ones that give you a long list of threads, but the way that web site
displays the forum is superb....
Any Ideas?
Craig Pickles
cpickles@yahoo.com
------------------------------
Date: 16 Dec 1997 08:20:33 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Kerberos authentication
Message-Id: <m34t49l0oe.fsf@windlord.Stanford.EDU>
PETER <PETER@yalevm.ycc.yale.edu> writes:
> Can anyone post an example of doing Kerberos authentication from within
> a Perl script?
What level of problem are you trying to solve? I do Kerberos
authentication all the time from inside a Perl script just by running
ksrvtgt or kinit, but if you want to interface directly with the Kerberos
libraries you'll need more than calling external programs.
I believe there's a GSS-API module floating around, but I don't think the
support for talking directly to Kerberos is very complete. Whether you
want to talk krb4 or krb5 is also going to make a big difference.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 16 Dec 1997 08:22:41 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Looking to work with Perl for Master's Thesis
Message-Id: <m31zzdl0ku.fsf@windlord.Stanford.EDU>
Bradley M Kuhn <bmk@agnostic.ebb.org> writes:
> However, I don't know what to do. I need to find something that is
> theoretical and research-y enough to pass off on my advisor (who loves
> Scheme and Java, BTW, which means Scheme-Java-Perl cross-over stuff
> might be good), but still make it implementable in my short 1.25 years
> of work on my thesis.
You may want to take a look at Larry Wall's way of making Java and Perl
cooperate (it's on the CD that comes with the Perl Resource Kit) and
seeing if you could do something similar for Scheme, or otherwise build
off of that work.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 16 Dec 1997 16:23:26 GMT
From: tony@crux.blackstar.co.uk (Tony Bowden)
Subject: Re: NEED: Fast, Fast string trim()
Message-Id: <882289444.275242@sparc.tibus.net>
Aaron Harsh (ajh@rtk.com) wrote:
: $string =~ s/^\s*(|.*\S)?\s*$/$1/;
: This looks even more cryptic than the original one-liner, so Mark should be
: happy :-)
Excellent ...
Now, what's the fastest way of removing all unwanted whitespace, which
means triming all leading and trailing spaces, _and_ trimming multiple
whitespace down to single spaces? Can this be done easily in one pass?
Tony
--
-----------------------------------------------------------------------------
Tony Bowden | tony@tmtm.com / NooNoo@teletubbies.org / http://www.tmtm.com/
Belfast, NI | How can you be a nymphomaniac and never had sex? / I'm choosy
-----------------------------------------------------------------------------
------------------------------
Date: Tue, 16 Dec 1997 16:26:30 +0100
From: Koos Pol <koos_pol@bigfoot.com>
Subject: Re: newbie = ? on executing OS/2 commands via system(), ++regexp
Message-Id: <34969DA6.3290@bigfoot.com>
Carl Lucio Marino wrote:
>
> I want to execute some OS/2 commands stored in a file,
> from my perl program. No problem, I'll use system().
>
> For example, I want to read a file with a command like:
> xcopy \admin\stuff\*.dat %home%\data
>
> problem: the environment variable %home% isn't expanded, but taken
> literally!
>
> ~~~~~~~~~~~
>
> Another option would be to execute a .cmd file (or a .bat file in M$DOS
> terms) - but system() complains saying the .cmd file isn't of the
> correct executable format - yeah, I knew that.
>
I figure that somewhere down the line you made an error. I have Perl
5.004_04 running on Warp 4.0. I tested your situation and it works
alright for me. The environment variable SOMEDIR is expanded perfectly:
[c:\test]
set SOMEDIR=C:\OS2
test.cmd contains:
xcopy %somedir%\*.* >nul
test.pl contains:
system 'test.cmd';
--
Koos Pol
----------------------------------------------------------------------
S.C. Pol tel: +31 20 3116122
PC Systems Administrator email: Koos_Pol@bigfoot.com
Compuware Europe PGP public key available upon request
A little inaccuracy sometimes saves tons of explanation.
-- H. H. Munroe
------------------------------
Date: Tue, 16 Dec 1997 01:39:43 -0800
From: Pete Hurd <phurd@teleport.com>
Subject: Re: newbie file input question
Message-Id: <34964C5E.B6F99E1B@teleport.com>
Thanks!
--
Peter L. Hurd,
phurd@BOGUSteleport.com <- remove BOGUS to reply
http://toaster2.zool.su.se/pete.html
------------------------------
Date: Tue, 16 Dec 1997 01:42:03 -0800
From: Pete Hurd <phurd@teleport.com>
Subject: Re: newbie file input question
Message-Id: <34964CEB.51F81A37@teleport.com>
Thanks!
--
Peter L. Hurd,
phurd@BOGUSteleport.com <- remove BOGUS to reply
http://toaster2.zool.su.se/pete.html
------------------------------
Date: 16 Dec 1997 16:00:23 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Newbie question.
Message-Id: <6768in$abm$1@lyra.csx.cam.ac.uk>
Roger Hansson <qpkrogh@epk.ericsson.se> wrote:
>My question is as follows:
>
>Can I use include files in Perl , like I use include files in C?
>I have a couple of scripts that use the same subroutines/functions, and
>I want to have only one version of each subrutine/function.
The "require" function will include a file for you.
See 'perldoc -f require'.
If you are going to do much of this, it will repay you to learn how to
package up your subroutines as a module. See the perlmod man page
and the "use" function.
Mike Guy
------------------------------
Date: 16 Dec 1997 16:11:46 GMT
From: peter.edlund@capgemini.se
Subject: Re: Newbie question.
Message-Id: <676982$r3h$1@news.capgemini.se>
>My question is as follows:
>
>Can I use include files in Perl , like I use include files in C?
>I have a couple of scripts that use the same subroutines/functions, and
>I want to have only one version of each subrutine/function.
>
>/Roger Hansson
require <file> is the way to do it.
read the man pages, especially perlsyn and require entry in perlfunc and perlmod.
//peter.
--
-------------------------
Peter Edlund
UNIX development engineer
Cap Gemini
peter.edlund@capgemini.se
------------------------------
Date: Tue, 16 Dec 1997 09:37:32 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: Re: Newbie question.
Message-Id: <3496AE4C.A89EA56C@mystech.com>
Roger Hansson wrote:
> My question is as follows:
>
> Can I use include files in Perl , like I use include files in C?
> I have a couple of scripts that use the same subroutines/functions, and
> I want to have only one version of each subrutine/function.
Yes - and it is relatively easy to do! Unfortunately, understanding HOW it
works is a little beyond the scope of a discussion group. :-( To get you
started, create a file with your common subroutines, say subA() and subB().
At the top of this file, put the following lines:
package MyStuff; # use any name you want in place of 'MyStuff'
require Exporter;
@ISA = qw( Exporter );
@EXPORT = qw( subA subB );
@EXPORT_OK = ();
sub subA
{
# stuff here
}
sub subB
{
# more stuff here
}
Save this file with the name "MyStuff.pm". In the file where you want to
use these subroutines, just type
use MyStuff; # will look for "MyStuff.pm" in the current directory
somewhere near the top. The subroutines subA() and subB() can then be
called!
For more info, look at chapter 5 in "Programming Perl".
HTH,
Mark Reibert
-----------------------------
Mark S. Reibert, Ph.D.
Mystech Associates, Inc.
3233 East Brookwood Court
Phoenix, Arizona 85044
Tel: (602) 732-3752
Fax: (602) 706-5120
E-mail: reibert@mystech.com
-----------------------------
------------------------------
Date: 16 Dec 1997 08:10:19 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: pgp encrypion via perl script
Message-Id: <m3afe1l15g.fsf@windlord.Stanford.EDU>
Michael Budash <mbudash@sonic.net> writes:
> Russ Allbery <rra@stanford.edu> wrote:
>> Correct me if I'm wrong, but it seems like he uses echo to pass the
>> encrypted data into PGP and then reads the unencrypted data off a pipe
>> from PGP. Under that system, there's no way for the unencrypted data
>> to show up in the output of ps.
> Er ... in my example, I use echo to pass the _unencrypted_ data _to_ pgp
> via a pipe, then simply capture the _encrypted_ data from pgp's stdout
> via perl's backtick facility.
Anything you put on the command line of a command or in its environment is
visible to all other users on the machine via ps, under nearly all
versions of Unix.
> FYI to all, I'm using PGP 5.0 for Irix Unix, not 2.6.2. PGP 5.0 is much,
> much better.
That's a matter of opinion. PGP 2.6.2 is free; PGP 5.0 is not. PGP 2.6.2
is therefore infinitely superior to 5.0 as far as I'm concerned because I
can actually use it.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 16 Dec 1997 09:48:14 -0700
From: NerveGas <NerveGas@nospam.com>
Subject: Re: Please advise. Fastest way to line-count files
Message-Id: <3496B0CE.7B72@nospam.com>
> > 2. In perl I can do it in two ways.
> > A1:
> > open FH, $file;
> > while (<FH>){$linecount++}
>
> > A2:
> > open FH, $file;
> > @jj = <FH>;
> > $linecount = $#jj + 1;
>
> > 3. The file sizes are significant (small files: 3M , large files: 60M
Here is a not-so-elegant approach, but probably one of the fastest
you'll find:
#!/usr/local/bin/perl
$result=`wc -l qq.pl`;
$result =~ s/ //g;
$result =~ s/qq\.pl//g;
print($result);
This will use the unix "wc" command, which is optimized for counting the
lines, and can do so much more quickly than Perl can.
NerveGas
------------------------------
Date: 16 Dec 1997 11:29:21 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: rindex ?
Message-Id: <676a91$3o8$1@stok.co.uk>
In article <67650t$f05$1@paris.magic.fr>, LE CORRE <lecorre@magic.fr> wrote:
>Do you know what rindex mean ?? Thanks
>lecorre@magic.fr
I think of it as the Rightmost INDEX, index starts from the leftmost end
of a string (or a specified position) and works right looking for a match,
and rindex starts from the rightmost end of the string (or a specified
position) and works left looking for a match. For example
index 'banana', 'a' is 1
rindex 'banana', 'a' is 5
The number returned is the characater position of the start of the
occurrence of the substring ('a') we're looking for, the first character
is usually at 0.
The perlfunc manual page describes both index and rindex.
Hope this helps
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 16 Dec 1997 08:29:13 -0800
From: Russ Allbery <rra@stanford.edu>
To: "LE CORRE" <lecorre@magic.fr>
Subject: Re: rindex ?
Message-Id: <m3ra7djlpi.fsf@windlord.Stanford.EDU>
[ Posted and mailed. ]
LE CORRE <lecorre@magic.fr> writes:
> Do you know what rindex mean??
It's the same as index(), except that it starts from the right side of the
string instead of the left.
perldoc -f rindex would have told you this, for future reference.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 16 Dec 1997 15:50:52 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Teaching programing
Message-Id: <ELAHCt.37x@ig.co.uk>
In article <67082l$jb5@news1.citylink.de>,
Janos Blazi <jblazi@wuerzburg.netsurf.de> wrote:
>I have to teach programing to 15-years old pupils. Is PERL a good language
>to start with? Our "authorities" seem to prefer PASCAL, but PASCAL seems to
>be absolutely dead and the first steps in PERL are perhaps easier than the
>first steps in C. Or should I take BASIC (oh horror!)?
BASIC is a good first step. It provides a fast development track with
a simple and clean user interface.
However, most 15 year olds today should be savvy enough to be able to
skip straight to Pascal. Also, remember that Pascal was designed as a
teaching language. BASIC was originally designed for non computer-
literate (non JCL-aware) users at a time when interactive timesharing systems
were new inventions... This is the reason it encmpasses its own mini OS
(save/load/run).
Pascal is not perfect but provides
* data typing
* scope and visibility models
* simple clean control flow constructs
* good error checking (for most pascal compilers)
* iteration and recursion are not awkward
It is a simple, clean orthogonal language.
Other languages aimed at educational use such as Logo may also
be a good first step.
I would (depending upon skills etc) start with Pascal. It provides
a better programming model for teaching than BASIC.
There should be some very good Pascal primers designed for teaching
purposes.
All the best,
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: 16 Dec 1997 08:18:42 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Teaching programing
Message-Id: <m37m95l0rh.fsf@windlord.Stanford.EDU>
? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> writes:
> While a few weeks ago I was argueing that Perl was a dreadfull learning
> langwige, I have had some what of a demositic experence. The persence
> of a garbige collector and the diagnostics.pm module both aid the new
> learner. Plus the persence of good books and the on line manule.
I'll agree with most of that, but the presence of a garbage collector
tends to make programmers lazy about memory issues (since they don't have
to think about them). As long as you intend to stick with programming
languages with GC, that's fine, but it makes for drastic culture shock
when you start trying to use C.
(Personally, I learned how to program in VMS BASIC -- which doesn't
require line numbers and is generally more functional than one would
expect from BASIC -- and then went on to Pascal with pointers and then C.
I knew LISP, sed, some awk, C, C++, and a few other things before I ever
learned Perl, and found that prior experience valuable in choosing what
dialect of Perl I wanted to speak for a particular problem.)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Tue, 16 Dec 1997 19:30:25 GMT
From: Michel.Dalle@sni.be (Michel Dalle)
Subject: Re: Using Excel95 with Perl
Message-Id: <676det$a8c$1@horus.mch.sni.de>
In article <MPG.eef62f7e1130e59989683@news>, bodemann@do.isst.fhg.de (Jvrn Bodemann) wrote:
>
>I want to save an ASCII column in Excel 4.0
>format. For that I have to open Excel95,
>transfer the data into it, and ask Excel
>to save the data in a specific format.
>
>In one sentence: I want to control Excel
>(something that can't be done :-)
>form Perl.
>
>Any ideas?
>
>Jvrn
See the Excel example in oleauto.html of the Perl-Win32 documentation.
But if you want to use Perl and only need an "ASCII column", why not output
your data to a simple text file, and read that directly in Excel 4.0
afterwards ?
Michel.
------------------------------
Date: 16 Dec 97 08:36:27 GMT
From: bgjohnso@unix.amherst.edu (Brad Johnson)
Subject: What's your favorite UNIX pl-db?
Message-Id: <34963d8b.0@amhnt2.amherst.edu>
I (like the rest of the world) an attempting to implement database
integration with web pages using perl--this summer I went through the
Win95-ODBC MsAccess SQL route, but I need to now do work on UNIX.
So I'd like some general feedback, if possible, on what people have
found to work--I don't need anything particularly strong, and in
fact would like something that works on a simple level, perhaps
w/ text files.
Unfortunately, I'm not conversant with any db standards associated
with UNIX, eg sed and awk stuff...
The shql module seems to be nice, but how do I implement that
in Perl? How do I construct an equivalent to the DB->SQL command
in ODBC? Can the ODBC.pm module be used in Unix on text files?
Thanks, and happy coding.
--bradj.
------------------------Nullus Oppidenda Est--------------------------
brad johnson (bgjohnso@unix.amherst.edu) 'Disc, God, Country, Pork'
http://www.amherst.edu/~bgjohnso/ 'Chickens! No Cynics!'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
------------------------------
Date: 16 Dec 1997 08:28:19 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Why does my suid program have /dev/fd/3 in $0
Message-Id: <m3u3c9jlr0.fsf@windlord.Stanford.EDU>
In comp.lang.perl.misc, lee gammell <lee.gammell@feedME> writes:
> I have a suid/sgid script called dbkill.pl, however when i try and print
> out $0 in a USAGE clause it prints as "/dev/fd/3" not "dbkill.pl". I
> know this is because it is a suid; is there some other way to get the
> real script name?
No, not that I'm aware of. The reason why Perl does this for setuid
scripts on platforms that support them securely is to avoid the race
condition that could occur if someone could replace the script out from
under Perl after Perl had executed with the changed UID but before it read
the script.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 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 1483
**************************************