[13900] in Perl-Users-Digest

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

No subject found in mail header

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 10 17:44:58 1999

Date: Tue, 9 Nov 1999 15:15:33 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942189332-v9-i1330@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 9 Nov 1999     Volume: 9 Number: 1330

Today's topics:
        Newbie Help:  Splitting Large file into smaller files <Susan.Isaacs@ucop.edu>
        Newbie: Need help parsing html file for links (jim)
        Newbie: Need help parsing html file for links (jim)
        Newbie: Need help parsing html file for links (jim)
    Re: Newbie: Need help parsing html file for links (Dan Lyke)
    Re: Newbie: Need help parsing html file for links <emschwar@rmi.net>
    Re: perl as first language? (Damian Conway)
    Re: perl as first language? <cassell@mail.cor.epa.gov>
    Re: perl as first language? <jll@skynet.be>
    Re: perl as first language? <jll@skynet.be>
        Perl EXE? barrytrot@yahoo.com
    Re: Perl Extensions. Arrgh. <dan@tuatha.sidhe.org>
    Re: Perl Extensions. Arrgh. (Ilya Zakharevich)
    Re: Perl Extensions. Arrgh. <dan@tuatha.sidhe.org>
    Re: perl/cgi create user using user nobody (webserver) (Kragen Sitaker)
        Piping script to Perl <wesmorrison@juno.com>
    Re: porting ksh to perl <rgsmith@c-gate.net>
        Programming style <balance08@bow.intnet.mu>
    Re: Programming style (Matthew Bafford)
    Re: Programming style (Kragen Sitaker)
        Reflective <balance08@bow.intnet.mu>
    Re: Reflective (Matthew Bafford)
    Re: Reflective (Kragen Sitaker)
        regular expression help <Iceberg@groovy.msu.montana.edu>
    Re: regular expression help <schuette@umr.edu>
    Re: regular expression help <vincent.murphy@cybertrust.gte.com>
        Rounding numbers to specific decimal places <kfratzke@luminet.net>
    Re: Rounding numbers to specific decimal places <emschwar@rmi.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 09 Nov 1999 14:10:48 -0800
From: "S. Isaacs" <Susan.Isaacs@ucop.edu>
Subject: Newbie Help:  Splitting Large file into smaller files
Message-Id: <38289BE8.A0B8EB5E@ucop.edu>

Hello All,

I am very new to PERL and need to split a large file into smaller
files.  The file looks something like
this:


 ./NEWFILE EDB0002,P=3,TITLE=Some text
another record
another record
another record
another record
 ./NEWFILE EDB0003,P=3,TITLE=Some text
another record
another record
 ./NEWFILE EDB0004,P=3,TITLE=Some text
another record
another record
another record
another record
another record
another record
another record
another record

What I need to do is break this file up into new files that look like
filename1: EDB0002 which contains:

 ./NEWFILE EDB0002,P=3,TITLE=Some text
another record
another record
another record
another record

filename2: EDB0003 which contains:

 ./NEWFILE EDB0003,P=3,TITLE=Some text
another record
another record

etc.

Your help would be most appreciated,

Susan




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

Date: Tue, 09 Nov 1999 21:02:47 GMT
From: one12@usa.net (jim)
Subject: Newbie: Need help parsing html file for links
Message-Id: <382886c4.7792024@supernews.dnai.com>

I'm just starting out with perl and would appreciate some help with
reg expressions.

I basically connect to the web server and retrieve a page and read it
as one huge line. i.e. (... <a href=xxxxx>something</a>\r\n...(next
line)).

anyways, i'm trying to extract the html links given by href=xxxx from
the "one line" string.   I have a while loop like the following...

## while it's like (xxx\nxxxxx\nxxxx<axxxxxxxxxxx>xxx\nxxx\nxxx\n)

while ($readLine =~ /^(.|\n)*?<a(.*?)>(.|\n)*/i) { 
   $testLink = $2;
   $remainder = $3;
  ##  parse the testLink for a match then assign remainder to
  ## $readLine to be parse again.
 . 
 ...
 ...
 ...
   $readLine = $remainder;
}

I *think* the beginning (.|\n)*? works, but it might be working for
*some* cases only.  also, since the statement <a href=xxxx> doesn't
have to be one contiguous line, but instead separated onto different
lines (....<a\r\nhref = \r\nxxxxx>......) the second pattern grouping
(.*?) probably should be changed to something else since "." doesn't
count for '\n'.  but I didn't have any success finding the right
pattern. Help!!!!!

also, when the link <a href=xxxx> *is* on one line, both the first and
second patterm matching works but the third one (.|\n)* doesn't pick
up anything, although it's supposed to pick up basically everything
after the '>'..  at least that was my intention.

can someone help me fix or completely rewrite the reg expression
statement i have?  I'm only starting out so don't laugh if my
statement makes no sense. haha..

thanks

Jim


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

Date: Tue, 09 Nov 1999 21:19:38 GMT
From: one12@usa.net (jim)
Subject: Newbie: Need help parsing html file for links
Message-Id: <38288fe7.10131298@supernews.dnai.com>

I'm just starting out with perl and would appreciate some help with
reg expressions.

I basically connect to the web server and retrieve a page and read it
as one huge line. i.e. (... <a href=xxxxx>something</a>\r\n...(next
line)).

anyways, i'm trying to extract the html links given by href=xxxx from
the "one line" string.   I have a while loop like the following...

## while it's like (xxx\nxxxxx\nxxxx<axxxxxxxxxxx>xxx\nxxx\nxxx\n)

while ($readLine =~ /^(.|\n)*?<a(.*?)>(.|\n)*/i) { 
   $testLink = $2;
   $remainder = $3;
  ##  parse the testLink for a match then assign remainder to
  ## $readLine to be parse again.
 . 
 ...
 ...
 ...
   $readLine = $remainder;
}

I *think* the beginning (.|\n)*? works, but it might be working for
*some* cases only.  also, since the statement <a href=xxxx> doesn't
have to be one contiguous line, but instead separated onto different
lines (....<a\r\nhref = \r\nxxxxx>......) the second pattern grouping
(.*?) probably should be changed to something else since "." doesn't
count for '\n'.  but I didn't have any success finding the right
pattern. Help!!!!!

also, when the link <a href=xxxx> *is* on one line, both the first and
second patterm matching works but the third one (.|\n)* doesn't pick
up anything, although it's supposed to pick up basically everything
after the '>'..  at least that was my intention.

can someone help me fix or completely rewrite the reg expression
statement i have?  I'm only starting out so don't laugh if my
statement makes no sense. haha..

thanks

Jim


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

Date: Tue, 09 Nov 1999 21:52:12 GMT
From: one12@usa.net (jim)
Subject: Newbie: Need help parsing html file for links
Message-Id: <38289789.12085538@supernews.dnai.com>

I'm just starting out with perl and would appreciate some help with
reg expressions.

I basically connect to the web server and retrieve a page and read it
as one huge line. i.e. (... <a href=xxxxx>something</a>\r\n...(next
line)).

anyways, i'm trying to extract the html links given by href=xxxx from
the "one line" string.   I have a while loop like the following...

## while it's like (xxx\nxxxxx\nxxxx<axxxxxxxxxxx>xxx\nxxx\nxxx\n)

while ($readLine =~ /^(.|\n)*?<a(.*?)>(.|\n)*/i) { 
   $testLink = $2;
   $remainder = $3;
  ##  parse the testLink for a match then assign remainder to
  ## $readLine to be parse again.
 . 
 ...
 ...
 ...
   $readLine = $remainder;
}

I *think* the beginning (.|\n)*? works, but it might be working for
*some* cases only.  also, since the statement <a href=xxxx> doesn't
have to be one contiguous line, but instead separated onto different
lines (....<a\r\nhref = \r\nxxxxx>......) the second pattern grouping
(.*?) probably should be changed to something else since "." doesn't
count for '\n'.  but I didn't have any success finding the right
pattern. Help!!!!!

also, when the link <a href=xxxx> *is* on one line, both the first and
second patterm matching works but the third one (.|\n)* doesn't pick
up anything, although it's supposed to pick up basically everything
after the '>'..  at least that was my intention.

can someone help me fix or completely rewrite the reg expression
statement i have?  I'm only starting out so don't laugh if my
statement makes no sense. haha..

thanks

Jim


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

Date: 9 Nov 1999 21:40:15 GMT
From: danlyke@news.pixar.com (Dan Lyke)
Subject: Re: Newbie: Need help parsing html file for links
Message-Id: <80a4bv$l9f$1@sherman.pixar.com>

jim (one12@usa.net) wrote:
: anyways, i'm trying to extract the html links given by href=xxxx from
: the "one line" string.   I have a while loop like the following...
: 
: ## while it's like (xxx\nxxxxx\nxxxx<axxxxxxxxxxx>xxx\nxxx\nxxx\n)
: 
: while ($readLine =~ /^(.|\n)*?<a(.*?)>(.|\n)*/i) { 

I'll dip my feet into the dangerous waters of c.l.p.m, but I'm a Perl
semi-newbie too.

I'd change this to:

    /^(.*?)\<a(.*?)\>(.*)$/si

From the perlre man pages, the /s option allows '.' to match newlines.
This also has the advantage of getting your "*?" inside the parens,
I'm not sure what the other produces but I've this horrible feeling that
it's either a single character $1 and $3 or some sort of really bizarre
array structure.

And the trailing "$" makes sure that final match goes to the end of the
string.

You might also consider subclassing the HTML::Parser to do this, as
it'll save you work in parsing out $2 as this expression gives it to
you. On the other hand I've worked with enough "almost HTML" files to
know that sometimes "RE"s are the winning technology.

Dan / http://www.flutterby.com/


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

Date: 09 Nov 1999 15:52:49 -0700
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Newbie: Need help parsing html file for links
Message-Id: <xkf4sevb7lq.fsf@valdemar.col.hp.com>

one12@usa.net (jim) writes:
> I'm just starting out with perl and would appreciate some help with
> reg expressions.

That's commendable, but you don't appear to have

A) read perlre
B) read the FAQ, which states that trying to use regexes to parse HTML is 
   futile, and generally a waste of time.

> anyways, i'm trying to extract the html links given by href=xxxx from
> the "one line" string.

RTFFAQ.

-=Eric
-- 
"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
                -- Johnny Hart


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

Date: 9 Nov 1999 19:04:29 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: perl as first language?
Message-Id: <809r7t$1a7$1@towncrier.cc.monash.edu.au>

abigail@delanet.com (Abigail) writes:

>How can you not expose someone to a new paradigm and learn him/her
>his/her first language? Whether the language will be procedurial,
>object oriented, design by contract or functional, it will be new.

But most humans are used to programming in the imperative long before they
see their first programming language:

	"Take two eggs, separate the yolks, and beat the whites
	 until soft peaks form..."

	"To set the clock on your VCR, press and hold the CLOCK button,
	 then repeatedly press the + button to advance the clock to the
	 correct time..."

	"Lather. Rinse. Repeat."

	etc.

>;; Java    - please, no

>Any reason why not?

Ever tried to explain Java's "Hello world" to a complete beginner?


>I disagree with Perl, for the same reason I don't recommend C. It's way
>too messy and there's too much rope. That's great for someone who knows
>what they are doing, but not good for someone who doesn't. First learn
>to program, then you know how to exploit the mess and ropes of Perl and C.

Amen, sibling!

See: http://www.cs.monash.edu.au/~damian/papers/PS/SevenDeadlySins.ps
for plenty more examples of rope.

Damian


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

Date: Tue, 09 Nov 1999 11:43:22 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: perl as first language?
Message-Id: <3828795A.9E2C4108@mail.cor.epa.gov>

Abigail wrote:
> 
> David Cassell (cassell@mail.cor.epa.gov) wrote on MMCCLX September
> MCMXCIII in <URL:news:38274A95.7874C759@mail.cor.epa.gov>:
> ;; Abigail wrote:
[snip]
> ;; Java    - please, no
> 
> Any reason why not?

Well, other than the fact that the neonate programmer will
pass out when you show him/her/it the requisites to produce
a script that does next to nothing...

[snip]
> ;; By these standards, one could list APL and J [*not* JScript,
> ;; mind you] in here too.  And PL/1 and PL/C, and a dozen others.
> 
> Perhaps, but I don't know enough about those languages.

Oh.  I misunderstood.  Sorry.  I thought you were deliberately
leaving them off your list because you thought they were
inappropriate.
<Emily Litella>
Never mind...
</Emily Litella>
 
> ;; And Perl too.  Andrew Johnson's "Elements of Programming
> ;; with Perl" is a good intro computing text which uses
> ;; Perl as the language of choice - and does a good job of
> ;; both.
> 
> I disagree with Perl, for the same reason I don't recommend C. It's way
> too messy and there's too much rope. That's great for someone who knows
> what they are doing, but not good for someone who doesn't. First learn
> to program, then you know how to exploit the mess and ropes of Perl and C.

A valid POV.  Shall we agree to disagree on this?  I thought
that Andrew J.'s book did a really good job of introducing
the layperson to programming, and that Perl fit into his
framework quite well.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 09 Nov 1999 23:45:07 +0100
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: perl as first language?
Message-Id: <m3wvrrz3m4.fsf@enterprise.newedgeconcept>

abigail@delanet.com (Abigail) writes:

> ;; Eiffel  - maybe

No, certainly not Eiffel, the most futile exercise in meaningless
renaming and feature approximation I know of.

> ;; Java    - please, no
> 
> Any reason why not?

Because in Java you put an apple in a basket and you get an object
back. Java's static typing is a lie. The worst of Smalltalk blended
with the worst of C++.

> ;; Lisp    - maybe
> ;; Scheme  - well.. okay...

CLOS? The only language I know of that actually makes the distinction
between polymorphism and membership.

> I disagree with Perl, for the same reason I don't recommend C. It's way
> too messy and there's too much rope. That's great for someone who knows
> what they are doing, but not good for someone who doesn't. First learn
> to program, then you know how to exploit the mess and ropes of Perl
> and C.

Programming is 'practical philosophy'. The more job you get done, the
better you feel.

Perl has a very interesting edge compared to languages like C++. You
don't need to know a lot of Perl to get a lot of functionality
working. In part thanks to CPAN. In part thanks to the ease of string
manipulation (even before regexes, interpolation is a major lever). In
part thanks to the short development cycle.

AND I'll cast three excellent languages as candidates for 'first
language':

- Simula: where it all began

- Smalltalk

- Beta, the most orthogonal language I know of after Lisp.

-- 

 V
VLR		Jean-Louis Leroy
 F		http://users.skynet.be/jll


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

Date: 09 Nov 1999 23:45:38 +0100
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: perl as first language?
Message-Id: <m3so2fz3l9.fsf@enterprise.newedgeconcept>

> I disagree with Perl, for the same reason I don't recommend C. It's way
> too messy and there's too much rope. That's great for someone who knows
> what they are doing, but not good for someone who doesn't. First learn
> to program, then you know how to exploit the mess and ropes of Perl
> and C.

The ropes don't need to be used. Nor boasted about.

Here's a funny story. In the Belgian Appeal Court project we use Perl
and Tangram (an object-relational mapper) to administrate a database
of objects that is otherwise mostly exploited by a C++ app. Some parts
of the main app are also written in Perl (instantiation of document
templates, transfer of Criminal Files between Courts, etc).

Geert, one of my colleagues, has been programming significant chunks
of our app. In Perl, yep! It has lasted for more than a year, and
guess what he asked me the other day? "How do I process a file in
Perl". No kidding.

Let this sink in. He did not know about open(), yet he had done
significant work in Perl.

Thinking about it, I suppose he doesn't know about $_, regexes, $1,
local (but he knows about my all right), etc.

AND (I say again) YET HE HAS CODED COMPLICATED, SIGNIFICANT PARTS OF
OUR APP. IN PERL!

So in the end it all depends on the instructor, I would guess.

And perhaps on Ilya Z's success at lobbying for a pedantic mode ;-)

-- 

 V
VLR		Jean-Louis Leroy
 F		http://users.skynet.be/jll





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

Date: Tue, 09 Nov 1999 22:35:52 GMT
From: barrytrot@yahoo.com
Subject: Perl EXE?
Message-Id: <80a7k8$kuj$1@nnrp1.deja.com>

I have made several perl scripts that I would like to be able to
distribute in "executable form".

In other words, I want to have one install program which will create
all of the things that you need to run my scripts.

I want this to be platform independent if possible.

Basicly, I want to allow people to run my cgi-perl scripts from their
own machine without having to connect to the internet and my computer.

Any help with this would be greatly appreciated.

Thanks.



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 09 Nov 1999 20:20:36 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl Extensions. Arrgh.
Message-Id: <om%V3.2641$c06.22924@news.rdc1.ct.home.com>

Arved Sandstrom <Arved_37@chebucto.ns.ca> wrote:
> In article <G2TV3.32729$pf4.29675@news-server.bigpond.net.au>, "Douglas
> Garstang" <dgarstan@nsw.bigpond.net.au> wrote:

>> ... I must really be doing something wrong, because:
>> void
>> foo()

OUTPUT:
  RETVAL

will fix the problem.

>> CODE:
>> RETVAL = 5;
>> 
> And indeed you are - the return type of foo() is declared as void, but you
> are setting RETVAL nonetheless. Change void to int and see how that goes.

Nope. void in XS isn't the same as void in C. It means either "Go figure
out if I'm returning an SV". In this case it's OK. Better to be explicit
with a return type of SV *, but not an error.

					Dan


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

Date: 9 Nov 1999 22:23:32 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Extensions. Arrgh.
Message-Id: <80a6t4$65h$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Dan Sugalski 
<dan@tuatha.sidhe.org>],
who wrote in article <om%V3.2641$c06.22924@news.rdc1.ct.home.com>:
> > And indeed you are - the return type of foo() is declared as void, but you
> > are setting RETVAL nonetheless. Change void to int and see how that goes.
> 
> Nope. void in XS isn't the same as void in C. It means either "Go figure
> out if I'm returning an SV". In this case it's OK. Better to be explicit
> with a return type of SV *, but not an error.

I do not think you are right.  Given CODE/PPCODE without output,
return value specificator is most probably ignored.

How would you think RETVAL is going to be declared in your example?

Ilya


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

Date: Tue, 09 Nov 1999 22:33:39 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl Extensions. Arrgh.
Message-Id: <7j1W3.2655$c06.23147@news.rdc1.ct.home.com>

Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was sent to Dan Sugalski 
> <dan@tuatha.sidhe.org>],
> who wrote in article <om%V3.2641$c06.22924@news.rdc1.ct.home.com>:
>> > And indeed you are - the return type of foo() is declared as void, but you
>> > are setting RETVAL nonetheless. Change void to int and see how that goes.
>> 
>> Nope. void in XS isn't the same as void in C. It means either "Go figure
>> out if I'm returning an SV". In this case it's OK. Better to be explicit
>> with a return type of SV *, but not an error.

> I do not think you are right.  Given CODE/PPCODE without output,
> return value specificator is most probably ignored.

> How would you think RETVAL is going to be declared in your example?

If you'll notice, I added in an OUTPUT: RETVAL to the example.

The use of void to mean "well, go guess" is mildly depricated at this
point, but it does work and I expect it will for some considerable time to
come.

						Dan


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

Date: Tue, 09 Nov 1999 19:41:43 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: perl/cgi create user using user nobody (webserver)
Message-Id: <XN_V3.61368$23.2363819@typ11.nn.bcandid.com>

In article <808cch$8pl$1@nnrp1.deja.com>,  <amir@infoteen.com> wrote:
>I am in desperate need of help. How can I let the user, nobody (my
>webserver Apache is running as nobody) create users? or how can I have
>this script run as root. I tried this:
>chown root:nobody adduser.cgi; chmod u+s,o-rwx adduser.cgi
>but it does not run as root. What can I do?

You could use a setuid program.  I'd bet you $1000 [0] that if you
write it yourself, it'll have a security hole in it that'll let anyone
who can log in on the machine get root.

Alternatively, you could use a daemon that listens on a Unix socket,
much like userv[1], but you'll still probably screw it up.  (You might
be able to use userv.)

>I need this ASAP, please!

Do not post to Usenet when you need things ASAP.  People will just
respond, "FOAD".

[0] Figuratively; I don't gamble.
[1] http://www.chiark.greenend.org.uk/~ian/userv/
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 9 Nov 1999 17:37:30 -0500
From: "Wes Morrison" <wesmorrison@juno.com>
Subject: Piping script to Perl
Message-Id: <80a7t0$2p9$1@progress.progress.com>

I am attempting to duplicate the behavior of the Perl interpreter when it is
invoked with no arguments, where the script may be typed in, e.g.

C:\>perl
print "Hello";^D
Hello
C:\>

I want to do this under the control of a program, not manually at the
command line.

I am starting up a Perl interpreter (from another program) with no
arguments, getting the stdin and stdout handles, and passing it the script
on stdin. I have tried ending the script with EOT (^D) or "__END__" (each
followed by newlines.) When I read from stdout, all I get is the script
echoed back, but not the output. If I continue to write to stdin, I can
continue to read stdout and get back what I sent, so it appears that I am
not closing the script correctly. I have tried every combination I can think
of.

If I instead use the -e argument to pass my "print" statement when Perl is
invoked, then I can get the script's output on stdout, so stdout

Any ideas?




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

Date: Tue, 9 Nov 1999 13:07:57 -0600
From: "Roger" <rgsmith@c-gate.net>
Subject: Re: porting ksh to perl
Message-Id: <809rkp$ph8@enews4.newsguy.com>


John Everitt wrote
>Jonathan,
>
>Thanks for the reply, however, I'm looking to run the existing scripts on a
>machine, i.e. Windows NT, that does not have the korn shell installed.
>Obviously the best idea would be to
>rewrite the scripts [in Perl].

Yes!

> as a stop gap measure
>Any other ideas ?
>

A quick solution may be the Korn shell included in
the Thompson Toolkit, which claims full Korn shell compatibility.


See their website at
http://www.teleport.com/~thompson/toolkit.html
for contact information.  as I am not sure about the current
availability, NT support, etc. I lasted used this product as
a way to dope with Windows 3.1. [ironic typo, no?]

I seem to recall that Microsoft makes the Mortice Kern systems
Korn shell available for Windows NT, but I recall reports
that this MKS version is less than 100% compatible.
To what degree this would affect you, I cannot say.

ps:
Are you sure that U/WIN performance problems are
not due to the overhead of providing missing O/S functionality?

See also:
http://www.kornshell.com/

There is also the public domain Korn shell, pdksh 5.2.13,
which is built with the Cygwin library to give compatibility
with the *nix system calls and environment.  Note that
"there are still a few differences from ksh88 "
and some ksh93 features are not yet implemented:
Pdksh: http://www.cs.mun.ca/~michael/pdksh/

cygwin library and pointers to aps built with same:
http://sourceware.cygnus.com/cygwin/


Good luck.





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

Date: 9 Nov 1999 18:41:34 GMT
From: "Jean-Patrick Madelon" <balance08@bow.intnet.mu>
Subject: Programming style
Message-Id: <01bf2a16$4c3ee2a0$330eead4@pat>

Does Perl support pure programming style?
Does it support side effects?


Jean-Patrick


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

Date: Tue, 09 Nov 1999 21:00:05 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Programming style
Message-Id: <slrn82h2ee.2r0.*@dragons.duesouth.net>

Once upon a time (9 Nov 1999 18:41:34 GMT), Jean-Patrick Madelon"
<balance08@bow.intnet.mu> was attempting to figure out Ilya's new Perl
regex features, and accidently sent the following to
comp.lang.perl.misc: 
: Does Perl support pure programming style?

Depends on who's programming in it.

: Does it support side effects?

Depends on who's programming in it.

Perhaps you should read the manual pages for Perl.

man perl

We are here to help, but you are expected to read before you post.  Most
of the messages you have posted are fully answered in the manual.

: Jean-Patrick

--Matthew


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

Date: Tue, 09 Nov 1999 21:55:06 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Programming style
Message-Id: <_K0W3.61748$23.2380067@typ11.nn.bcandid.com>

In article <01bf2a16$4c3ee2a0$330eead4@pat>,
Jean-Patrick Madelon <balance08@bow.intnet.mu> wrote:
>Does Perl support pure programming style?

It has closures and is dynamically typed, so I'd say yes.  If you want
lazy evaluation, you have to hack it yourself, though.

>Does it support side effects?

Yes.  Typical Perl programs make extensive use of them.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 9 Nov 1999 18:42:38 GMT
From: "Jean-Patrick Madelon" <balance08@bow.intnet.mu>
Subject: Reflective
Message-Id: <01bf2a16$73a985c0$330eead4@pat>

Is Perl fully reflective?


Jean-Patrick.


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

Date: Tue, 09 Nov 1999 21:03:33 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Reflective
Message-Id: <slrn82h30g.2r0.*@dragons.duesouth.net>

On 9 Nov 1999 18:42:38 GMT, Jean-Patrick Madelon"
<balance08@bow.intnet.mu> cut a telephone line, and tapped the following
to comp.lang.perl.misc using only his tongue: 
: Is Perl fully reflective?

Are you a vampire?

Out of all of your questions, this is probably the only one that isn't
answered in the FAQ.  Most likely, that is only because I have no idea
what you mean by reflective.

Perhaps you should read the manual pages for Perl.

man perl

We are here to help, but you are expected to read before you post.  Most
of the messages you have posted are fully answered in the manual.

: Jean-Patrick.

--Matthew


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

Date: Tue, 09 Nov 1999 22:02:00 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Reflective
Message-Id: <sR0W3.61753$23.2380961@typ11.nn.bcandid.com>

In article <01bf2a16$73a985c0$330eead4@pat>,
Jean-Patrick Madelon <balance08@bow.intnet.mu> wrote:
>Is Perl fully reflective?

I'm not sure, as I've never used a fully reflective language.  Symbol
tables are available for inspection and modification at run-time, class
names take the role of metaclass objects, the inheritance hierarchy is
available for inspection and modification at run-time, and it's
possible to trap and handle calls to nonexistent methods or functions.
The handler function, called AUTOLOAD after its most common use, gets
the string name of the missing function.  The only truly private data
is the bindings of closures, which cannot be inspected from outside the
closure.  There are no data structures whose size cannot be queried.

Does that answer your question?
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Tue, 9 Nov 1999 14:58:48 -0700
From: Ivan Berg <Iceberg@groovy.msu.montana.edu>
Subject: regular expression help
Message-Id: <Pine.LNX.4.10.9911091457360.23555-100000@groovy.msu.montana.edu>

Ok, you regular expression experts

How would you grab all text after 6 periods in a string.

For example, in the string

"blah.23.0993.cs.monkey.s.This.is.what,I.want"

I could get "This.is.what,I.want"

Thanks




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

Date: Tue, 09 Nov 1999 16:31:51 -0600
From: Matt Schuette <schuette@umr.edu>
Subject: Re: regular expression help
Message-Id: <3828A0D7.B4A88543@umr.edu>

Ivan Berg wrote:

> Ok, you regular expression experts

I don't claim to be an expert

> How would you grab all text after 6 periods in a string.
>
> For example, in the string
>
> "blah.23.0993.cs.monkey.s.This.is.what,I.want"
>
> I could get "This.is.what,I.want"

my $string = "blah.23.0993.cs.monkey.s.This.is.what.I.want";
$string =~ /([^.]*\.){6}(.*)/;
my $end = $2;
print $end;

This returned "This.is.what.I.want".  Tried one or two things to "break"
it and it seemed to be fine.  The -w option and "use strict;" didn't
complain about anything.

Matt



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

Date: Tue, 09 Nov 1999 22:43:50 GMT
From: Vincent Murphy <vincent.murphy@cybertrust.gte.com>
Subject: Re: regular expression help
Message-Id: <xjgln87l1zu.fsf@gamora.ndhm.gtegsc.com>

>>>>> "Ivan" == Ivan Berg <Iceberg@groovy.msu.montana.edu> writes:

    Ivan> Ok, you regular expression experts
    Ivan> How would you grab all text after 6 periods in a string.

    Ivan> For example, in the string

    Ivan> "blah.23.0993.cs.monkey.s.This.is.what,I.want"

perl -e '$str="blah.23.0993.cs.monkey.s.This.is.what,I.want"; 
$newstr= $1 if $str =~ /(?:\w*\.){6}(.*)/; 
print qq(\$str = $str\n);
print qq(\$newstr= $newstr\n);'

output:

$str = blah.23.0993.cs.monkey.s.This.is.what,I.want
$newstr= This.is.what,I.want

the \w may not be what you want though.


    Ivan> Thanks

HTM


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

Date: Tue, 09 Nov 1999 13:36:18 -0800
From: kfratzke <kfratzke@luminet.net>
Subject: Rounding numbers to specific decimal places
Message-Id: <000b8d9b.e2392647@usw-ex0101-006.remarq.com>

Howdy...

Pretty stupid question...I need a hint on how to round numbers to a
specific number of decimal places.

I'm doing some english to metric value conversion and need to hold 2
and 4 decimal places of data in various situations.

I can't find anything specific on this topic...thought I was on track
when I read about the truncate function, but that only works on file :-(

I know...read the book right...please somebody pitty me and point me in
the right direction...

Kirk Fratzke
kfratzke@luminet.net


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 09 Nov 1999 15:41:33 -0700
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Rounding numbers to specific decimal places
Message-Id: <xkfaeonb84i.fsf@valdemar.col.hp.com>

kfratzke <kfratzke@luminet.net> writes:
> Pretty stupid question...I need a hint on how to round numbers to a
> specific number of decimal places.

Okay.

Hint: read perlfaq4: "Does perl have a round function?   What about
ceil() and floor()? Trig functions"?

> I can't find anything specific on this topic...thought I was on track
> when I read about the truncate function, but that only works on file :-(

What happened when you tried "perldoc -q round"?  Or maybe even "perldoc
perltoc | more"?

-=Eric
-- 
"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
                -- Johnny Hart


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 1330
**************************************


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