[6807] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 432 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 5 12:17:28 1997

Date: Mon, 5 May 97 09:00:23 -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           Mon, 5 May 1997     Volume: 8 Number: 432

Today's topics:
     Re: [++] Re: Question: regexp reduction? <yingchen@fir.fbc.com>
     Re: [DRAFT] RFD: comp.lang.perl reorg (A. Deckers)
     Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-p (Steffen Beyer)
     Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-p (Steffen Beyer)
     Ask a stupid question! thanks. (%,5\.&'=*x)
     Re: CGI scripts <abennett@stonehill.edu>
     checking IP's & MAC of 40,000 hosts <diana.march@spamfree.fmr.com>
     Re: Combining 2 GIFs in Perl? (Andrew M. Langmead)
     Comparing multi-line variables (Zachary Brown)
     Re: File Descriptors (Quentin Fennessy)
     Re: GIF in Base64 encoding? (brian d foy)
     Re: Help with compiling 5.003 on SCO-3.2v4.2 (Hans-Georg Rist)
     Re: How to do a "less" on a file. (Steffen Beyer)
     Re: How to do a "less" on a file. (Andrew M. Langmead)
     Re: Loosing clpm regulars (was Re: Perl auto-replier) (Andrew M. Langmead)
     Re: Need file info for perl script (Honza Pazdziora)
     Re: Need help with a counter script! (Chris Russo)
     Re: output format (Eric Bohlman)
     Re: Perl CGI error (Michael Fuhr)
     Re: Printing to Files. <c.evans@clear.net.nz>
     Problem with uppercase reg exp mel@west.net
     Re: Problem with uppercase reg exp (Jordyn A. Buchanan)
     Re: Problem with uppercase reg exp <guenther@lunen.gac.edu>
     Q: special characters search and replace in perl (Sascha Kerschhofer)
     Re: space efficiency of arrays? (Eric Bohlman)
     Who Are You? <cristo@consotech.se>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 05 May 1997 10:33:29 -0600
From: "Ying Chen" <yingchen@fir.fbc.com>
Subject: Re: [++] Re: Question: regexp reduction?
Message-Id: <862845991.6613@dejanews.com>


In article <ebohlmanE9K5u5.50@netcom.com>,
  ebohlman@netcom.com (Eric Bohlman) wrote:
>
>
> Quentin Fennessy (quentin@remington.amd.com) wrote:
>
> : I understood Ying Chen to ask something different -- can a regular
> : expression be automatically reduced to a simpler regexp (a simpler
> : expression).  Think about algebraic expressions, and simplifying
> : those.  That is possible and relatively easy to program.  But
> : simplifying arbitrary regexps is hard.
>
> If you're talking about "pure" regexps (i.e. not using any Perl-specific
> extensions like backreferencing), then they correspond to DFAs, and there
> is an algorithm for minimizing the number of states in a DFA, so you
> could translate, minimize and then back-translate (note, though, that
> this might actually result in a longer regexp).

For the original question.. I was wondering more about perl regexp
(I suppose I am not very familiar with unix tools that uses similar
regexp..) - but..your posting made me look into the issue of DFA
(actually - first finding out what it is and then look for/read info)
As I browse the FAQ again... I came upon what perl regexp is suppose
to be more like NFA - (therefore the back-refencing features)
I suppose - to keep this simple - we can stick to DFA - but I suppose
using perl-backreferencing features the regexp can be reduced furthur?

I suppose ultimately I will be going to the book (Jeffery Friedl) ^_^

strange how my news servicer didn't show all your postings..
(that's why the posting is from dejanews)

and - thanks again -

Ying (new - and learning ^_^ )

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


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

Date: 4 May 1997 14:02:20 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: [DRAFT] RFD: comp.lang.perl reorg
Message-Id: <slrn5mp5nc.rjt.I-hate-cyber-promo@news.rediris.es>

[apologies for the change of subject]

In comp.lang.perl.misc,
	sb@en.muc.de wrote:
>Dear folks in this thread,
>
>by reading along in this thread I noticed that most of the postings here
>(including this one! :-) ) would not satisfy the quoted/unquoted text
>criterion.

Noted.

>> A.Deckers (I-hate-cyber-promo@man.ac.uk) wrote:
>> : In comp.lang.perl.misc,
>> : 	tcyang@netcom.com wrote:
>> : >You forgot one thing.  To create these groups, you have to win supports
>> : >for more than CLPM people.  There are elementary people who always believe
>> : >"moderation = censorship".  Present an explanation for these people first.
>
>> : Anyone who rants about the censorship issue in the context of a RFD for
>> : a technical group such as those proposed is probably a raving lunatic
>> : and therefore beyond reasoning, gruboursy being a case in point.
>
>Even if so, you can't exclude them for voting against (just like Tung-chiang
>Yang said), so better don't call them names, don't despise them and don't
>underestimate their possible importance.

No, I can't exclude them from voting, and I fully expect some of them
to vote against the proposal because of the moderation criteria.
Happens to every single moderated group that goes to a CFV.

As for not calling them names, you're right, I shouldn't, though I'm
not going to change my opinions. :-)

[...]
>(It's rather difficult to apply real censorship with a robo-moderator
>script because you can always find ways to circumvent it!)

You can trivially circumvent _any_ moderation model; there is no
difference between robo-moderation and hand-moderation in this sense.

>> : I'm sure some will crawl out of the woodwork when the official RFD is
>> : published, but I doubt there is anything we can say to change their
>> : point of view, they will probably be very few and I have better things
>> : to do than to waste my time in puerile shouting matches.
>
>See above: don't talk about people fearing censorship in this contemptful 
>way.

Ok, ok, I withdraw the "raving lunatic" charge, but I still don't
intend to get into debates about the _principle_ of moderation, though
I'm more than willing to ammend any of the details of _implementation_
in so far as they affect this proposal.

I've seen far too many philosophical debates about moderation in
news.groups, and they rarely get anywhere, largely because either side
just talks right past the other one. I'm not going to get involved in
that sort of debate. It'd be pointless to do so.

Cheers,

Alain

-- 
Perl information: <URL:http://www.perl.com/perl/>
        Perl FAQ: <URL:http://www.perl.com/perl/faq/>
    Perl archive: <URL:http://www.perl.com/CPAN/>


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

Date: 4 May 1997 07:55:20 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-process,programmer,regex}
Message-Id: <5khfd8$bu0$2@en1.engelschall.com>

Mark Mills <mark@ntr.net> wrote:

> >             moderated comp.lang.perl.data-structure
> >             moderated comp.lang.perl.inter-process
> >               moderated comp.lang.perl.programmer
> >                 moderated comp.lang.perl.regex

> I'd honestly just like a c.l.p.moderated
> or at most c.l.p.regex and c.l.p.programmer
> IMHO I don't see enough dsc and iproc stuff to warrant the other two.

Yes, please!

Sometimes when you have a question you don't really know where the problem
lies, so you are giving incentive to postings to multiple groups at the
same time if you split up the groups in too narrow categories.

Let's start with only *one* moderated group as a beginning. We will see
then if the need exists for more groups.

That's the usual USENET way, BTW.

> Keep up da good work. :>

Seconded!!

But beware: if you're really going to let the Java people write the
robo-moderator script, you're running the risk of getting lynched! ;-)

Yours sincerely,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: 4 May 1997 08:16:21 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: [DRAFT] RFD: comp.lang.perl.{data-structure,inter-process,programmer,regex}
Message-Id: <5khgkl$jbj$1@en1.engelschall.com>

Dear folks in this thread,

by reading along in this thread I noticed that most of the postings here
(including this one! :-) ) would not satisfy the quoted/unquoted text
criterion.

I'm not sure about what that means:

Should we exclude ourselves from this discussion because we're obviously
not conforming to our own criteria, or should we change the quoted/unquoted
text criterion in the RFD we are currently talking about? :-)

Tung-chiang Yang <tcyang@netcom.com> wrote:
> Well, right now I am working on robomoderation of
> "soc.culture.taiwan.moderated", and I encounter this problem.  You can
> say with 97% confidence that "soc.culture.xxx" is more flame-oriented
> than CLPM and more people will believe in "moderation = censorship",
> but judging from the recent Tom incident about munging addresses, I
> found that CLPM does not lack this kind of people.

> Personally I do support a moderation or robomoderation of some newsgroups
> under CLP.  However, I just tried to remind you that you had better
> present some statistics to convince people.  Unfortunately, people not
> in CLPM can also vote yes or no on the proposal, and they might cast
> the votes without reading CLPM at all (maybe they do not know Perl) but
> just based on their feelings of "moderation/antimoderation".  Say, people
> who like to post "Perl vs. TcL" might be the people who will cast "no"
> for your proposal.  They will feel "they lose something" if CLPM is
> moderated.

Good points!

> A friend of CLPM posted regularly statistics about CLPM, and I found that
> to be a good idea.  I wrote a similar Perl program and grab statistics
> for SCTaiwan for presenting the crossposting statistics.  Maybe you want
> to do similar things for CLPM, say, the statistics about CGI/WWW posts
> here.

> P.S.  I am usually overcareful for things, so maybe you can safely ignore
>       my reminder :)

I don't agree with that! I think you're not being OVERcareful, just
careful, which is good, IMHO.

And I don't think we should ignore your reminder!!

> ==========================================
> A.Deckers (I-hate-cyber-promo@man.ac.uk) wrote:
> : In comp.lang.perl.misc,
> : 	tcyang@netcom.com wrote:
> : >You forgot one thing.  To create these groups, you have to win supports
> : >for more than CLPM people.  There are elementary people who always believe
> : >"moderation = censorship".  Present an explanation for these people first.

> : Anyone who rants about the censorship issue in the context of a RFD for
> : a technical group such as those proposed is probably a raving lunatic
> : and therefore beyond reasoning, gruboursy being a case in point.

Even if so, you can't exclude them for voting against (just like Tung-chiang
Yang said), so better don't call them names, don't despise them and don't
underestimate their possible importance.

It's a legitimate fear, after all, even if it has no founding in reality
in this case.

(It's rather difficult to apply real censorship with a robo-moderator
script because you can always find ways to circumvent it!)

> : I'm sure some will crawl out of the woodwork when the official RFD is
> : published, but I doubt there is anything we can say to change their
> : point of view, they will probably be very few and I have better things
> : to do than to waste my time in puerile shouting matches.

See above: don't talk about people fearing censorship in this contemptful 
way.

After all, we've already seen a lot of attempts (some even successful!) to
install censorship on the Internet.

You're not doing the Perl community any favour with this.

> : I guess I'm agreeing with you but I don't think this is anything to
> : worry about in this case. All we can do is point them towards the
> : rationale, which IMHO makes clear why moderation is desirable, and hope
> : that the vast majority of news.groups and clpm regulars will make a
> : sensible reading of this.

I hope so, too. :-)

Yours,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: Mon, 05 May 1997 02:20:14 GMT
From: a9438@mail.kscgeb.edu.tw (%,5\.&'=*x)
Subject: Ask a stupid question! thanks.
Message-Id: <336d41c5.7806797@news.ks.silkera.net>

As the title,this is a simple question :

 If I didn't have server. Is it possible to run perl on my PC.
I only have Win95 and perl for Win32 in my PC.

Someone said I need Website,is it true? 

What software I need to install ,if I want to run perl?

Thanks for telling me the answer.




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

Date: Mon, 05 May 1997 11:00:18 +0100
From: Aaron Bennett <abennett@stonehill.edu>
Subject: Re: CGI scripts
Message-Id: <336DAFA7.6596@stonehill.edu>


> X-Can't-Spell: Yes


<illiteracy>

> <sarcasim>
> Hm.  Wasn't aware of more than one CGI.  I guess I figured that the NCSA
> implementation from a few years ago was good enough.
> </sarcasim>
> 
> Jeremy
> ---
> Jeremy D. Zawodny
> http://www.bgsu.edu/~jzawodn/
> Computer Science Undergraduate, Bowling Green State University
> "Lab-Tech: It's not just a job.  It's an attitude!" -- Me

</illiteracy>





-- 
|	Aaron Bennett
|	Internet Services Coordinator
|       Stonehill College Department of Academic Computing
| 		http://www.stonehill.edu                       
|			"The most precious things remain unseen."


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

Date: Mon, 05 May 1997 10:07:27 -0400
From: Diana March <diana.march@spamfree.fmr.com>
Subject: checking IP's & MAC of 40,000 hosts
Message-Id: <336DF7AF.40DD@spamfree.fmr.com>

We have 40,000 hosts and 1 inaccurate database.  I understand that this
is a common problem that others may have had to deal with in the past
and I was interested in getting some input from people who have had to
deal with this issue.  

I have over 25 workstations at my disposal so I was considering
splitting up the IP's and doing a fast ping however I am begining to
wonder how useful the information returned would be.  If a machine
doesn't respond it doesn't necessarly mean that it isn't around.

So I guess I have several questions;

1. Does anyone have a script for fast pinging a ton of machines?
2. How useful have you found this script to be?
3. I will also need to get the MAC address does anyone have any
suggestions as to where I should start?

Thanks for you input.
Diana
diana.march@fmr.com


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

Date: Sun, 4 May 1997 13:57:59 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Combining 2 GIFs in Perl?
Message-Id: <E9ntGn.F2M@world.std.com>

Chris King <Chris.King@swindon-fc.demon.co.uk.mars> writes:

>On Fri, 2 May 1997 at 09:15:02 in article <galfano-0205970915020001@164.
>67.58.21>, Steven Galfano <galfano@ucla.edu> writes
>>Anyone know a way of conquering this? Are GIFs combinable?

>Posibly asking in a more relevant newsgroup you may find the answer to
>your question:

>comp.infosystems.www.authoring.cgi and
>comp.infosystems.www.authoring.images immediately spring to mind.

I think you are getting a bit out of hand here. Not all questions
while working on CGI programs are CGI questions.

If I posted. "I'm working under X Windows. I want to combine 5 gif
images and pass them to xv." should it be redirected to
comp.infosystems.www.authoring.{cgi,images}?
comp.graphics.{algorithm,api}, maybe, but not a www group.


Steven specifically mentioned the project requirements that have been
decided at this point. the OS is NT. The language is perl. He needs to
manipulate GIF images in his perl script, the answer is of course, the
GD library. (which has nothing to do with WWW.)

If the OS was unix, the pbm utilities might also be a consideration.

-- 
Andrew Langmead


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

Date: 5 May 1997 08:10:55 -0400
From: zbrown@lynx.dac.neu.edu (Zachary Brown)
Subject: Comparing multi-line variables
Message-Id: <5kkiof$l70@lynx.dac.neu.edu>

Given two variables $a and $b containing multiple lines of ascii text, how
could perl locate all the start and end indices of the words or groups of
words that are different in one from the other and vice versa? 

Thanks,

Zack



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

Date: 5 May 1997 15:00:07 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: File Descriptors
Message-Id: <5kksln$4je$1@amdint2.amd.com>


In article <336A7EF8.76DF@emeryworld.com>,
A. Mishra <mishra.aditya@emeryworld.com> wrote:
>Why can I open only 251 file descriptors with perl when the
>system limit is 1024/process.Actually these descriptors happen
>to be sockets.
>
>I running perl on Sun Solaris 2.5.1

On Solaris there are hard and soft limits for some system  resources.
The default soft limit is 255 fd, and the hard limit is 1024.
To use the larger number (hard limit) you use setrlimit(2).

I don't know if you can use setrlimit(2) from within perl -
possibly you can with syscall.  Otherwise you can wrap your
perl program with a C program that calls setrlimit.

See the Solaris 2 FAQ list for more information.  And the
Solaris 2 Sysadmin Answerbook.


-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: Mon, 05 May 1997 11:13:21 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: GIF in Base64 encoding?
Message-Id: <comdog-0505971113210001@nntp.netcruiser>

In article <5kioqk$1oak$1@tiger.middlebury.edu>, "Otis Gospodnetic"
<otisg@panther.middlebury.edu> wrote:

> I was wondering if anyone knows how I can Base64 encode a GIF?

the same way you encode any other data.
 
> I looked at MIME::Base64, but the pod says that the module is for encoding
> strings (as opposed to images).  But, can I simply open() the GIF and use
> this MIME::Base64 to encode the data I read after open()ing ?

read the GIF data into some variable. then encode that data.  data
are data -- perl doesn't care what you call it or how you use it.

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: Sun, 04 May 1997 14:42:01 GMT
From: rist@zkrd.de (Hans-Georg Rist)
Subject: Re: Help with compiling 5.003 on SCO-3.2v4.2
Message-Id: <336c9ade.10255735@news.uni-ulm.de>

chetan@chetan.tiac.net (Chetan Muni) wrote:

>Has someone out there compiled perl5.003 for SCO3.2v4.2?
>I tried it with gcc2.7.2 and Configure complained something
>like "WHOA there, gcc doesn't seem to work..."
>
>So tried with the native cc.  Miniperl fails to build with a
>link error:
>    Unresolved symbols:
>	Perl_chsize in libperl.a
>(Don't have the verbatim error message.)
>
>Any help with compiling perl503 or pointers to pre-built
>binaries is greatly appreciated.

I was able to compile Perl5.003_93 for SCO3.2v4.2 (miniperl, see
below) a few weeks ago (it was my perl highlight of the week/month or
even year, while being unsuccessful with previous versions of perl5). 

Here are some answers to the questions of 'sh Configure',
for which I didn't accept the [default]:

- Binary compatibility with Perl 5.003? [y] n
- Shall I use nm to extract C symbols from the libraries? [n] y
- What is the type for group ids returned by getgid()? [gid_t]
  unsigned short
- What type is the second argument to getgroups()? [unsigned short]
  gid_t
- What type is lseek's offset on this system declared as? [off_t] long
- What type is used for file modes? [mode_t] int
- What is the type for user ids returned by getuid()? [uid_t]
  unsigned short
- What extensions do you wish to include?
  [Fcntl IO NDBM_File ODBM_File Opcode POSIX SDBM_File Socket]
  Fcntl IO Socket

I didn't find a hint in the documentation which extension I really
need.

Compiling terminated at the DynaLoader with "Arg list too long" (does
anybody have a solution?), but 'miniperl' was compiled successfully
and ALL tests with 'make minitest' were successful, too.

Then I did a manual installation (see hints in INSTALL):
  cp miniperl perl
  ./perl installperl
  ./perl installman

problem: a2p and s2p are missing

Regards,
HG

| Hans-Georg Rist     ZKRD, Zentrales Knochenmarkspender-Register
| Helmholtzstr. 10    Deutschland, gGmbH
| P.O.B. 4244         German National Registry of Bone Marrow Donors
| D-89032 Ulm         http://www.zkrd.uni-ulm.de
| Phone: +49 731 95430-46, Fax: +49 731 95430-50, email: rist@zkrd.de


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

Date: 4 May 1997 07:42:24 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: How to do a "less" on a file.
Message-Id: <5khel0$bu0$1@en1.engelschall.com>

[Courtesy Cc: sent to cited author]

> johnliao@cs.buffalo.edu (John Liao) wrote:

> > open (FILE, "hugefile")||die "cant open";
> > while (<FILE>){
> >         print $_;
> > }
> > close FILE;
> > 
> > Now if the "hugefile" is like 2 thousand lines long,
> > it'll just scroll by the screen. Is there a way in perl
> > to do a "less" or "more" on the output. I have try the 
> > following, but it didnt work.
> > 
> > open (FILE, "hugefile")|| die "can't open";
> > open (OUTPUT, "less |");
> > while (<FILE>){
> >         print OUTPUT $_;
> > }
> > close FILE;

Hello John Liao, ignore the following, he's telling you pretty
confused stuff (see workin code below!):

Jordyn A. Buchanan <jordyn@bestweb.net> wrote:
> There are a couple of problems with the approach above:
>     1.  less only prints things out one page at a time when
>         it is printing directly to a terminal--if you redirect
>         its output (as you do above), it simply dumps all the
>         output.  It's a bit much to expect the other end of the
>         pipe to send back "space" characters or whatever to
>         continue to the next "screen".  (How big is a screen in
>         a pipe?)  If you think carefully about what your program
>         is doing, it's printing everything less hands off to it,
>         and certainly not waiting for the user to press any keys.

>     2.  Even if your approach would work, it would be a waste of
>         resources.  Essentially you're having perl open a file, 
>         direct its conents into a pipe to less, taking the output
>         of less back into perl, and ultimately printing it there.
>         Why not just have less do it all?

> I suppose the following would do what you want:

>    system("less hugefile");

> But that makes your perl program pretty superfluous.  You could also create
> your own paging routine, but that's re-inventing the wheel.

> Programs like less exist for the purpose of handling data from other
> programs.  The logical thing seems to be to not worry about how your data
> looks, dump it to STDOUT and allow people to use less or more or whatever
> they want to look at it.

> |Jordyn A. Buchanan                           jordyn@bestweb.net|
> |Senior System Administrator                     +1.914.271.4500|
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Shouldn't you know better? >;-)

Here's some code that works under all circumstances:
(it only pipes to "more" if STDOUT is connected to a terminal; otherwise,
it simply prints to STDOUT)

    unless ((-t STDOUT) && (open(MORE, "| more")))
    {
        unless (open(MORE, ">-"))
        {
            die "can't write to STDOUT: $!\n";
        }
    }
    while ($whatever)
    {
        print MORE "$whateveryouwant\n";
    }
    close(MORE);

Yours,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: Mon, 5 May 1997 12:07:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How to do a "less" on a file.
Message-Id: <E9pJ01.2MG@world.std.com>

jordyn@bestweb.net (Jordyn A. Buchanan) writes:

>There are a couple of problems with the approach above:
>    1.  less only prints things out one page at a time when
>        it is printing directly to a terminal--if you redirect
>        its output (as you do above), it simply dumps all the
>        output.  It's a bit much to expect the other end of the
>        pipe to send back "space" characters or whatever to
>        continue to the next "screen".  (How big is a screen in
>        a pipe?)  If you think carefully about what your program
>        is doing, it's printing everything less hands off to it,
>        and certainly not waiting for the user to press any keys.

I can't say this is the case for every pager ever created, (but I
don't know of any exceptions.) but more only waits for a character if
standard output is a terminal. If its a pipe, it is equivilient to
"cat". For example, this works:

     more /etc/passwd >junk.txt

>    2.  Even if your approach would work, it would be a waste of
>        resources.  Essentially you're having perl open a file, 
>        direct its conents into a pipe to less, taking the output
>        of less back into perl, and ultimately printing it there.
>        Why not just have less do it all?

But what if the posters "real" program did more to the file than just
read a line and print it? What if it really did some processing? What
if the poster substituted a simple "read a line/print a line" because
he wanted to reduce the program to the simplest standalone program
that exhibits his problem? (If so, I commend him for that.)

>Programs like less exist for the purpose of handling data from other
>programs.  The logical thing seems to be to not worry about how your data
>looks, dump it to STDOUT and allow people to use less or more or whatever
>they want to look at it.

Does your newsreader and mailreader use the same logic? I hope not.
-- 
Andrew Langmead


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

Date: Sun, 4 May 1997 14:10:24 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Loosing clpm regulars (was Re: Perl auto-replier)
Message-Id: <E9nu1C.J5v@world.std.com>

sb@en.muc.de (Steffen Beyer) writes:

>When I started learning and using Perl (4.036) about two years ago,
>I was glad to have this newsgroup to learn many tricks from.

>But soon I outgrew most of it, and the more I learned about Perl, the
>more I got tired of the highly repetitious "newbie" questions which
>are all contained in the FAQ now.

>Maybe two years ago the answers weren't in the FAQ, especially since
>then it was Perl 4.036 time and the transition to Perl 5 was sometimes
>difficult for people.

You bring up anothe point. This groups hasn't had a regularly posted
FAQ in years. And before that, the person who the FAQ maintainer had
instructed to post the FAQ on his behalf wasn't posting with "Expires"
headers to keep the article around. It was also out of date and had
little perl 5 information.

And now, the FAQ maintainer is complaining that the FAQ isn't getting
used. Its hard to turn back years of habit.


-- 
Andrew Langmead


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

Date: Sun, 4 May 1997 13:09:57 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Need file info for perl script
Message-Id: <adelton.862751397@aisa.fi.muni.cz>

John Verbrugge <jverb@iserv.net> writes:

> Does anyone know of any other file information I can get using Perl
> besides "ls -l" and the stat() command?
> 
> I'm trying to write a "super ls" program, but I need more info than
> stat gives.

There are -X types of checks (-B -k -S ...). What exactly do you need?

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Mon, 05 May 1997 08:17:25 -0700
From: crusso@alink.net (Chris Russo)
Subject: Re: Need help with a counter script!
Message-Id: <crusso-0505970817250001@buzz.alink.net>

In article <01bc589c$07045c40$306802cf@HOSTID.ctllc.com>, "Robert Pate"
<robert@ctllc.com> wrote:

>I need help with a counter program I want to write.  I can write all the
>code for the count and for the access info that I want, then only problem I
>am having is figuring out how to call the perl script with an img call from
>HTML (AND) have it return a gif image into the HTML showing the counter
>value.  I have pre-made digits in gif format. 
>
>Any help would be greatly appreciated. 

Sounds like an HTML question.  Why not ask it in one of the HTML groups?

comp.infosystems.www.authoring.cgi
comp.infosystems.www.authoring.html
comp.infosystems.www.authoring.images
comp.infosystems.www.authoring.misc

----------------------------------------------------------------------
Chris Russo                          A-Link Network Services, Inc.
crusso@alink.net                     Bolo me
http://www.alink.net/~crusso


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

Date: Sun, 4 May 1997 13:13:38 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: output format
Message-Id: <ebohlmanE9nrEq.DFH@netcom.com>

stephen farrell (stephen+usenet@farrell.org) wrote:

: You want to look at the printf functions -- they work just like as in
: C.

: hmm...  Just for the heck of it I just checked it out, and the
: following doesn't work as expected:

: 	printf("%0.3f", $x);

: I'd expect "0" to mean "0", not "1"... =( 

As you say, printf and sprintf in Perl work just like they do in C, which 
means that in an f-type specifier, the number before the decimal point 
specifies the *total* number of characters (including the decimal point) 
to print, and the number after the decimal specifies the number of digits 
to print after the decimal point.  Unfortunately, it looks like printf 
insists on printing at least one digit before the decimal point, even if 
you use something like "%4.3f".
 


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

Date: 5 May 1997 08:17:18 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Perl CGI error
Message-Id: <5kkq5e$6jj@nova.dimensional.com>

    [ Followups set to comp.infosystems.www.authoring.cgi ]

theseus@wam.umd.edu (C. Scott Miller) writes:

> I am trying to write a perl script to interact with my web page.  I am
> getting a 'Forbidden' error from my browser when my page references the
> perl cgi script.  I have already chmodded the cgi script so that it can 
> be read and executed by everyone.  Why is this happening and what can be
> done to correct it? 

This is a CGI question, not a Perl question.  Try looking at the following:

    http://www.cis.ohio-state.edu/hypertext/faq/usenet/www/cgi-faq/faq.html
    http://www.perl.org/CPAN/doc/FAQs/cgi/perl-cgi-faq.html
    http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html

Hope this helps.
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: 05 May 1997 23:22:43 +1200
From: Carey Evans <c.evans@clear.net.nz>
Subject: Re: Printing to Files.
Message-Id: <87hggi2mf0.fsf@psyche.evansnet>


really_eliot@dg-rtp.dg.com_but_mangled_to_stop_junk_email writes:

> I've wondered about how to flush a file exactly once, and why such an
> "fflush" functionality doesn't appear to be part of standard perl.
> Care to expand on how to do it with $| ?

I've always done it with something like the following (if you want to
leave it off):

    $| = 1; print ""; $| = 0;

You can probably use blocks and local to leave it alone.

-- 
                Carey Evans  <*>  c.evans@clear.net.nz

"Encryption renamed to Encode to avoid US regulation problems"
                     - include/linux/wireless.h in Linux 2.0.30 kernel


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

Date: Mon, 05 May 1997 12:21:35 GMT
From: mel@west.net
Subject: Problem with uppercase reg exp
Message-Id: <336dce97.44072091@news.west.net>

Hi,
 
I'm somewhat new to PERL and am having a problem with case pattern
matching. Specifically, I'm trying to convert, for example,
weight_unit to Weight Unit. So far I've done this:

$x = "weight_unit";
$x =~ s/_/ /g;                         # convert underscores to spaces
$x =~ s/^\ba-z/A-Z/g;   # convert 1st letter of each word to uppercase

But all I get back is: weight unit. Can someone help with me with
this? I've tried some sensible variations, but none worked.

TIA,
Milt


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

Date: Mon, 05 May 1997 10:57:17 -0400
From: jordyn@bestweb.net (Jordyn A. Buchanan)
Subject: Re: Problem with uppercase reg exp
Message-Id: <jordyn-ya02408000R0505971057170001@nntp.bestweb.net>

In article <336dce97.44072091@news.west.net>, mel@west.net wrote:

> I'm somewhat new to PERL and am having a problem with case pattern
> matching. Specifically, I'm trying to convert, for example,
> weight_unit to Weight Unit. So far I've done this:
> 
> $x = "weight_unit";
> $x =~ s/_/ /g;                         # convert underscores to spaces
> $x =~ s/^\ba-z/A-Z/g;   # convert 1st letter of each word to uppercase
> 
> But all I get back is: weight unit. Can someone help with me with
> this? I've tried some sensible variations, but none worked.

The problem is that you're trying to treat s/// like a tr///.  The line:

   $x =~ s/^\ba-z/A-Z/g;

actuall searches at the start of a line for the characters "a-z" and will
replace them with "A-Z".  You could search for a *range* of characters, as
in:

   $x =~ s/\b[a-z]/A-Z/g;     # ^ only matches at the start of the line

But then you would end up with this:

   A-Zeight A-Znit

Obviosly not what you intend.  However, we can use the \u escape which
will capitalize the next character in a string.  This will do what you
want:

   $x =~ s/\b([a-z])/\u\1/g;

Jordyn

|---------------------------------------------------------------|
|Jordyn A. Buchanan                           jordyn@bestweb.net|
|Bestweb Corporation                      http://www.bestweb.net|
|Senior System Administrator                     +1.914.271.4500|
|---------------------------------------------------------------|


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

Date: 05 May 1997 09:44:58 -0500
From: Philip Guenther <guenther@lunen.gac.edu>
Subject: Re: Problem with uppercase reg exp
Message-Id: <e697mhe7zbp.fsf@lunen.gac.edu>


mel@west.net writes:

> I'm somewhat new to PERL and am having a problem with case pattern
> matching. Specifically, I'm trying to convert, for example,
> weight_unit to Weight Unit. So far I've done this:
> 
> $x = "weight_unit";
> $x =~ s/_/ /g;                         # convert underscores to spaces
> $x =~ s/^\ba-z/A-Z/g;   # convert 1st letter of each word to uppercase
> 
> But all I get back is: weight unit. Can someone help with me with
> this? I've tried some sensible variations, but none worked.

1) Why the '^'?
2) You're writing the regexp and replacement texts of the s/// as if you
	were writing a tr/// operation.  You need a character class on the
	left-hand side, and you need to capture the value using ()'s to
	be expanded via $1 on the right-hand side.  To do the uppercasing
	you should use the '\U' magic token (implemented using the uc()
	builtin), and to handle accented characters you should use \w as
	the character class.

In sum:

$x = "weight_unit";
$x =~ tr/_/ /;			# this should be faster than the s/// version
$x =~ s/\b(\w)/\U$1/g;

Of course, this is all explained in the FAQ, which also contains lots of
other useful snippets of code which you'll find you use all the time.  Why
don't you grab a copy now to get a better explanation of the above, and to
see what else you're missing.  10:1 odds you're making other mistakes that
the FAQ talks about...


Philip Guenther

---------------------------------------------------------------- 
Philip Guenther			UNIX Systems and Network Administrator
Internet: guenther@gac.edu	Voicenet: (507) 933-7596
Gustavus Adolphus College       St. Peter, MN 56082-1498


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

Date: Mon, 05 May 1997 17:28:50 +0200
From: e9127005@stud1.tuwien.ac.at (Sascha Kerschhofer)
Subject: Q: special characters search and replace in perl
Message-Id: <e9127005-0505971728500001@sozgr.htu.tuwien.ac.at>

How can I search and replace special characters wich are stored in an
associative array ?
In need to search for characters which hexcode is known (since I want to
recive messages from a HTML Form in german).

e.g. 
replace each characters which hexcode is C4 with "&Auml;".

the command 
                %data =~ s/\xC4/&Auml;/g;
doesnt work, since the s/// operator works only for scalar variables.
Im sure many have solved this problem, since characters like "& < >"
should be replaced with their HTML equivalent.
how can I search and replace in the values of an associated array in general?

Any help is greatly appreciated.

Sascha Kerschhofer, Vienna


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

Date: Sun, 4 May 1997 13:04:51 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: space efficiency of arrays?
Message-Id: <ebohlmanE9nr03.D4z@netcom.com>

Jonathan C. Willeke (jwilleke@ix.netcom.com) wrote:
: I'm posting this additional question before having seen any responses.
: I've decided to try using an array of bit fields.  (I realized how
: much space I'm wasting when I read, at
: www.doge.nl/~avdhorst/avdhorst.html, that someone had written a sieve
: that "packs all the 16-bit primes in slightly over 2 Kbyte".)

: Now that I'm learning about bit operations, I wonder to what extent I
: can rely on the precision of integers.  I believe the Camel book says
: 32 bits, 64 bits on some machines.  I initialize a 32-bit field to 1s
: by saying

You shouldn't have to worry about integer precision if you use vec() to 
create and manipulate your bit fields.  You might want to also check out 
the modules list at CPAN, as I remember seeing a couple modules (in 
various stages of development) for set operations, including one for 
"gappy and clumpy" sets like article numbers in .newsrc.



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

Date: Sun, 04 May 1997 10:52:21 -0700
From: Cristo <cristo@consotech.se>
Subject: Who Are You?
Message-Id: <336CCCD5.12F4@consotech.se>

HI!

This question is a bit tricky.

Im making a shopping system for a company. 
The idea is that the customers will be able to order T-shirts over the
net.

I need something to recognize each and every user. It has to be unique. 
I am using their IP-adress now.

My brother insists that I should use something that he calls "Process
ID", 
If you have a suggestion or comment please send it to me at:
cristo@consotech.se

/Best Regards Cristo


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

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

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