[7376] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1001 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 9 16:10:19 1997

Date: Tue, 9 Sep 97 13:00:43 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 9 Sep 1997     Volume: 8 Number: 1001

Today's topics:
     Re: [Q] Converting text to image <I_dont_like@green.eggs-and.spam>
     A simple regular epression question. <ztsaba@iil.intel.com>
     Re: A simple regular epression question. (Mike Stok)
     Access and Perl <derick@pacbell.net>
     Re: Beginner's question : Perl or Java ? <rra@stanford.edu>
     Book: Dynamic HTML Primer <jcburke@bellatlantic.net>
     Re: Book: Dynamic HTML Primer <ratzan@us.ibm.com>
     Calling a sub function on submit fischers@execpc.com
     Re: Converting text to Excel data with UNIX (David Tauzell)
     Re: DNS lookup with gethostbyaddr? <doug@tc.net>
     feeding keystrokes to telnet NOSPAMbob@hsph.harvard.edu
     Re: Flush query string? <rootbeer@teleport.com>
     Re: Free Perl Docs (was: Re: (no subject) ) <camerond@mail.uca.edu>
     Re: How to open a file for both read and write <charlie@flychina.com>
     How to rename /etc/passwd ? <Benarson.Behajaina@swh.sk>
     Re: How to rename /etc/passwd ? (Daniel E. Macks)
     Re: How to rename /etc/passwd ? <migliore+@andrew.cmu.edu>
     Re: How to rename /etc/passwd ? twod@not.valid
     Re: HTML docs <seay@absyss.fr>
     Re: Hunh? Why DOES this work??? (Trey Valenta)
     I think this is a simple question <haleysco@imsports.msu.edu>
     Re: Incredibly basic Newbie question <Fred@nospam.com>
     Re: Incredibly basic Newbie question <Fred@nospam.com>
     installing perl (problem pinned down, but I still need  <eglamkowski@mathematica-mpr.com>
     local array in subroutine <shawn_worsencroft@intercept.com>
     Re: local array in subroutine (Mike Stok)
     Re: Minimizing Memory Needed for Numbers Read from Bina <rootbeer@teleport.com>
     Re: perl win32 compiler??? (Robert J. Kent)
     Re: pipe in the mailer <Carry.Megens@nym.sc.philips.com>
     Print an Image <buck@huron.net>
     Re: Q: bitwise operators and perl (Jason Gloudon)
     Re: Q: HOWTO - Manifest Constants <rootbeer@teleport.com>
     Re: Regexp a Yes or No question? <rra@stanford.edu>
     Re: Regexp a Yes or No question? (Matti Kinnunen)
     removing shell comments from ksh scripts <jhunt@mltsa.uk.lucent.com>
     Sending a file with mailx using perl <Gary.P.Fontenot1@lmtas.lmco.com>
     Re: Syntax of SEARCHLIST in tr? (Mike Stok)
     Um... a bug? <arauramo@alpha.hut.fi>
     Re: Um... a bug? (Pete Ratzlaff)
     Re: Um... a bug? <doug@tc.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 9 Sep 1997 13:53:24 GMT
From: "Dan McGarry" <I_dont_like@green.eggs-and.spam>
Subject: Re: [Q] Converting text to image
Message-Id: <01bcbd27$76abb530$9a2ba92f@bmeria8c>

Kristian Elstad <kristian.elstad@interpost.no> wrote in article
<3413C912.357407C9@interpost.no>...
> Hi!
> 
> I am looking for a program that takes a text line or possibly several
> text lines and produses an image that
> displays this/these text lines. 

The easiest way to handle this would be to write a routine (in just about
any language) that simply plugs in images of each letter in the string. If
you need to track case, then use the numeric value of the character. You
could whip soemthing like that together in minutes....

-- 
Dan McGarry
http://www.moodindigo.com/


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

Date: Tue, 09 Sep 1997 16:45:56 +0300
From: Zohar Tsaba <ztsaba@iil.intel.com>
Subject: A simple regular epression question.
Message-Id: <34155314.794B@iil.intel.com>

Hi.

How can I match only 'not 00' ?

When I tried to use:
 
$x = "01010100001100" ;
$x =~ s/[^00]/X/g ; 	# I want to replace 'not 00' with X
			# 

printf "$x\n" ; 	# $x is '0X0X0X0000XX00'
			# which means, I replaced 'not 0 or not 0'

Please Help !
Thanks.
-- 
              
	      _________________________
           _ |      Zohar Tsaba        | _
          / )|  ztsaba@iil.intel.com   |( \
         / / |      04-8655852         | \ \
       _( (_ |        HAIFA            | _) )_
      (((\ \>|_/->_________________<-\_|</ /)))
      (\\\\ \ / /                   \ \ / ////)
       \       /                     \       /
        \    _/                       \_    /


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

Date: 9 Sep 1997 15:05:05 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: A simple regular epression question.
Message-Id: <5v3oj1$iof@news-central.tiac.net>

In article <34155314.794B@iil.intel.com>,
Zohar Tsaba  <ztsaba@iil.intel.com> wrote:
>Hi.
>
>How can I match only 'not 00' ?
>
>When I tried to use:
> 
>$x = "01010100001100" ;
>$x =~ s/[^00]/X/g ; 	# I want to replace 'not 00' with X
>			# 

$x =~ s/[^0]{2}/X/g

leaves $x with '0101010000X00' in it.  Is that what you want?

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 08 Sep 1997 23:21:33 -0700
From: "Derick A. Jackson" <derick@pacbell.net>
Subject: Access and Perl
Message-Id: <3414EAEC.2B22EC66@pacbell.net>

I am a microsoft database programmer that is attempting to use perl to
access data in a .mdb file.  Does anyone out there know of any perl
scripts for MS access?



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

Date: 09 Sep 1997 07:16:03 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Beginner's question : Perl or Java ?
Message-Id: <m3iuway3mk.fsf@windlord.Stanford.EDU>

dave <over@the.net> writes:

> I don't keep a very close eye on this stuff, but I did catch an article
> in BYTE about Java Server and Java Servlets.  Claimed servlets are much
> more efficient on NT as threaded tasks than are forked perl scripts.

Threading support is being integrated into Perl core for 5.005, which
should eliminate this gap again.  :)  (Of course, it may take a bit before
it's completely stable; Perl is a lot more complicated of a language in
some ways than Java is.)

This is pretty far off the subject line, though, since this certainly
isn't a beginner's question.  Beginners aren't going to be using
threading in general.

(This is probably also where such things as Apache's mod_perl and the
Fast::CGI stuff should be mentioned, if you're looking at improving
program performance on web servers.  TIMTOWTDI.)

-- 
#!/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,  9 Sep 1997 10:05:36 -0500
From: John Burke  <jcburke@bellatlantic.net>
Subject: Book: Dynamic HTML Primer
Message-Id: <Forum.873814083.8288.jcburke@john>


There's a new book available from MIS:Press called "Dynamic HTML: A Primer", by Simon St. Laurent. It's a great intro to the topic and perhaps the first book out on the subject. You can find more information and an excerpt at:

http://www.smartbooks.com/bw709dynhtmlprim.htm

I hope this is helpful.

John Burke




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

Date: Tue, 09 Sep 1997 08:13:43 -0700
From: John Ratzan <ratzan@us.ibm.com>
Subject: Re: Book: Dynamic HTML Primer
Message-Id: <341567A7.278B@us.ibm.com>

John Burke wrote:
> 
> There's a new book available from MIS:Press called "Dynamic HTML: A Primer", by Simon St. Laurent. It's a great intro to the topic and perhaps the first book out on the subject. You can find more information and an excerpt at:
> 
> http://www.smartbooks.com/bw709dynhtmlprim.htm
> 
> I hope this is helpful.
> 
> John Burke

Do you know of any additional books or resources on Dynamic HTML?

Thanks in advance.

John Ratzan
ratzan@us.ibm.com


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

Date: Tue, 09 Sep 1997 06:59:59 -0500
From: fischers@execpc.com
Subject: Calling a sub function on submit
Message-Id: <34153A3F.9AB0FD8D@execpc.com>

Here is a dilly of a problem.
I have a perl script that updates a database.  I want to do a 'onSubmit'
button that calls a sub function in the current script.  Problem is,
when the form is submitted, the script looks for the function on my
server, not in the script itself.  How do I get the script to look for
the function in itself, not on the server?



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

Date: 9 Sep 1997 13:11:50 GMT
From: tauzell@math.umn.edu (David Tauzell)
Subject: Re: Converting text to Excel data with UNIX
Message-Id: <5v3hum$gjc@epx.cis.umn.edu>

Nathan Stanford <nathan@cyberservices.com> writes:

>Don't pay someone to do it get a perl book it is not that hard to do.

Converting text data to tab delimited isn't very difficult.  However,
it seems that Joe wants to convert into or from native Excel format.
This will be *much* more difficult.  I once saw a book that described all
of the Microsoft formats, however they might be somewhat out of date by
now.

Dave. 

>Joe Petrow wrote:

>> Could somebody point me to some information on a Perl routine that
>> converts tab delimited text data in native Excel format?
>>
>> Or if not that, to a place that specifies exactly what native Excel
>> format
>> is?
>>
>> Thank you.
>>
>> Joe Petrow
>> joepet@server.berkeley.edu
>> http://server.berkeley.edu/~joepet



--
---
David Tauzell.  I like unix.


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

Date: 09 Sep 1997 10:27:44 -0400
From: Douglas McNaught <doug@tc.net>
Subject: Re: DNS lookup with gethostbyaddr?
Message-Id: <m2d8mio93z.fsf@ono.tc.net>

mbudash@sonic.net (Michael Budash) writes:

> I just went thru the same exercise a few weeks ago - see where you used
> AF_INET in your original example? Mine looked like that and didn't work
> either until I changed that AF_INET to 2. Now it works fine...

Don't do that.  Use the Socket module.

-Doug
-- 
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";


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

Date: Tue, 09 Sep 1997 10:03:16 -0600
From: NOSPAMbob@hsph.harvard.edu
Subject: feeding keystrokes to telnet
Message-Id: <873816060.12957@dejanews.com>

Is there a way to feed keystrokes from a script (tcsh or perl, for
example) to a telnet session attaching to another host? For example, I
want to manually telnet to host A, and then run some sort of script or
program that telnets to host B and feeds keystrokes to host B's session.

Host A is Solaris 2.x (we've got csh, sh, tcsh, perl, et. al.)

What fails is if I put the keystrokes in a file and use I/O redirection
like this:

         telnet hostb < keyfile

Also what fails is if I use a csh "HERE" document like this:

#!/bin/csh
telnet hostb <<EOF
cmd1
cmd2
EOF

Thanks in advance,
-Bob Byers
 Boston, MA
 NOSPAMbob@hsph.harvard.edu

 Please remove the "NOSPAM" from my email address before replying!

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


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

Date: Tue, 9 Sep 1997 08:03:29 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: David Mellors <dgm@globalnet.co.uk>
Subject: Re: Flush query string?
Message-Id: <Pine.GSO.3.96.970909080017.27604J-100000@julie.teleport.com>

On 8 Sep 1997, David Mellors wrote:

> Now, I have a HMTL form which is processed by a perl script. The script
> appends a file and outputs it to the browser. 
> 
> The problem is: When the browsers refresh button is pressed, the script
> is run again with the same parameters, resulting in the form details
> being appended to the file more than once! 
> 
> So, tell me.... Is there a way of stopping this? 

Yes; you use the same technique in Perl as you'd use if you were
programming your script in COBOL or Ada. :-)  (That's a clue that it's not
really a Perl question.)  You can probably get a more complete answer to
your CGI-specific question if you check the docs and FAQs of a CGI-related
newsgroup, but the key idea is that you write the script to reject
duplicate requests. Good luck! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 09 Sep 1997 07:33:36 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Free Perl Docs (was: Re: (no subject) )
Message-Id: <3415421E.C0609BB8@mail.uca.edu>


OK, hopefully this will be the last one I have to correct (the Netscape
newsreader keeps trying to put all of these into HTML, even when I spec
text).     :^O

Cameron Dorey wrote:

>
>
> Kenneth LO wrote:
>
>> On Fri, 5 Sep 1997, Erich Kreiselmaier wrote:
>>
>> > I am new to perl programming. Does anyone have a recommendation
>> for
>> > free available documentation.
>>
>> Attached is a course notes I downloaded from MU Campus Computing. It
>> is
>> from http://www.phlab.missouri.edu/perl/perlcourse.html. This url is
>> no
>> longer valid.
>
> The URL has changed to:
> http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html
> This is where I found it yesterday.
>
> Cameron Dorey
> camerond@mail.uca.edu





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

Date: 9 Sep 1997 13:25:33 GMT
From: "Charlie" <charlie@flychina.com>
Subject: Re: How to open a file for both read and write
Message-Id: <01bcbd23$e9738ba0$ae67e3c7@flychina>



Songtao Chen <songtao@nortel.ca> wrote
> Could anyone tell me how to open a file for both
> read and write ?

open(FH,"+>filename") || die "Cannot open filename\n";

Charlie Li



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

Date: Tue, 09 Sep 1997 16:51:16 +0200
From: Benarson Behajaina <Benarson.Behajaina@swh.sk>
Subject: How to rename /etc/passwd ?
Message-Id: <34156264.DCD24A8D@swh.sk>


I'm running Linux 2.0.27. Since there's no tool which may remove user,
I would like to write a short script that will do this.
I couldn't rename the /etc/passwd file, 'cause 'man perlfunc' says:
rename OLDNAME, NEWNAME
            Change the name of file. Will not work accross file system
            boundaries.

So my question is, how to write a Perl script that could update or
rename this file ?

    Thanks,

    Benarson.



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

Date: 9 Sep 1997 17:02:20 GMT
From: dmacks@sas.upenn.edu (Daniel E. Macks)
Subject: Re: How to rename /etc/passwd ?
Message-Id: <5v3ves$9gb$1@netnews.upenn.edu>

Benarson Behajaina (Benarson.Behajaina@swh.sk) said:
: I'm running Linux 2.0.27. Since there's no tool which may remove user,
: I would like to write a short script that will do this.
: I couldn't rename the /etc/passwd file, 'cause 'man perlfunc' says:
: rename OLDNAME, NEWNAME
:             Change the name of file. Will not work accross file system
:             boundaries.

So what's the problem? Someone'll correct me (as usual:) if I'm wrong,
but the issue isn't different fs's for perl compiler/script and the
file, but rather for OLDFILE and NEWFILE. Just like for mv...if you
want to move /mnt/fs1/dir/ to /mnt/fs2, you gotta cp -r, then rm the
original.

When in doubt, try it (with something less valuble than /etc/passwd:)

dan

-- 
Daniel Macks
dmacks@a.chem.upenn.edu
dmacks@netspace.org
http://www.netspace.org/~dmacks



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

Date: Tue,  9 Sep 1997 13:03:48 -0400
From: Robert J Migliore <migliore+@andrew.cmu.edu>
Subject: Re: How to rename /etc/passwd ?
Message-Id: <8o5M5om00WB90VOqs0@andrew.cmu.edu>


Excerpts from netnews.comp.lang.perl.misc: 9-Sep-97 How to rename
/etc/passwd ? by Benarson Behajaina@swh.s 
> I'm running Linux 2.0.27. Since there's no tool which may remove user,
> I would like to write a short script that will do this.
> I couldn't rename the /etc/passwd file, 'cause 'man perlfunc' says:
> rename OLDNAME, NEWNAME
>             Change the name of file. Will not work accross file system
>             boundaries.
>  
> So my question is, how to write a Perl script that could update or
> rename this file ?

Not to avoid your question, but how do people go about copying files in
general.. ?  I've been using shell commands and to my knowledge there is
no copy function (at least in any of the perl books I own).


-Rob





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

Date: 9 Sep 1997 17:47:33 GMT
From: twod@not.valid
Subject: Re: How to rename /etc/passwd ?
Message-Id: <5v423l$lcm$1@vnetnews.value.net>

: > I would like to write a short script that will do this.
: > I couldn't rename the /etc/passwd file, 'cause 'man perlfunc' says:
: > rename OLDNAME, NEWNAME
: >             Change the name of file. Will not work accross file system
: >             boundaries.
: >  
: > So my question is, how to write a Perl script that could update or
: > rename this file ?

: Not to avoid your question, but how do people go about copying files in
: general.. ?  I've been using shell commands and to my knowledge there is
: no copy function (at least in any of the perl books I own).

In brief, with no nicities (ie full error checking) :-

$file1 = "./blah";
$file2 = "./bleat";
open(FILE, "<$file1") || die;
@text = <FILE>;
close(FILE) || die;

open(FILE, ">$file2") || die;
print FILE @text;
close(FILE) || die;

Seeing as /etc/passwd is used by other processes quite a lot it may be 
advantageous to copy it rather than renaming it (its sudden disappearance could
cause something to break). Some form of locking may be nice to prevent others
updating the file at the same time.

IAP
--
In an attempt to reduce junk email I use an invalid 'From' address.
My correct email address can be determined by replacing 'not.valid' with with
'value.net'


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

Date: Tue, 09 Sep 1997 11:53:57 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: HTML docs
Message-Id: <34151CB5.21182277@absyss.fr>

Simon Griffiths wrote:
> 
> I can't seem to find any files for documentation of individual
> functions in the standard HTML documentation distribution
>  - eg pod/perlfunc/split.html.
> The links are there in pod/perlfunc.html, but no referenced files.
> 
> Can anyone tell me where I can get them.
> 
> Am I missing something obvious here ?


I don't know how the html file should be generated automatically (I'm
happy with the man pages, thankyouverymuch), but you can generated them
manually

	pod2html /usr/local/lib/perl5/pod/perl.pod

This spews html all over my standard out.  Maybe you can use this to do
what you want.

- doug


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

Date: 9 Sep 1997 15:56:23 GMT
From: trey@zipcon.net (Trey Valenta)
Subject: Re: Hunh? Why DOES this work???
Message-Id: <873820641.144433@ran.zipcon.net>

In <34146911.24603835@harp.gsfc.nasa.gov> Eryq <eryq@harp.gsfc.nasa.gov> writes:

>thought the following would be a syntax error, 

>	%ssn = (Fred   => 101,
>	        Sue    => 102,
>	        George => 103);
>	$name = 'Sue'; 	
>	print %ssn->{$name}, "\n";

>See what I mean with that %ssn->{$name} jazz?  I mean,
>I know it's SUPPOSED to be $ssn{$name}... so why is

If probably doesn't return an error because it's not wrong. It should be
$ssn->{$name} and not %name.... but as for the '->', it's essentially
implied in $ssn{$name}. Look at perllol for more information.

-Trey
--
Trey Valenta	trey@zipcon.net	 Seattle, WA



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

Date: 9 Sep 1997 15:01:13 GMT
From: "Scott" <haleysco@imsports.msu.edu>
Subject: I think this is a simple question
Message-Id: <01bcbd31$38bd2ba0$746a0823@IMW-231B.imsports.msu.edu>

Folks,
	Here's the deal:  I'm working on a web-based mortgage ammortization
applet.  My Perl script receives the necessary input from the first form
and I've got all the calculations down but I can't figure out how the print
the output.

I would like it to look something like this:

Beginning Balance	Interest Paid	Payment	Ending Balance
100,000			1000		1500		98,500
98,500			9850		1500		etc.

My problem is that I don't understand how to keep calculating and printing
at the same time.  For example how can I set the beginning balance in the
2nd line equal the the ending balance in the first line?  

Please Help!!!!!
		



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

Date: Mon, 08 Sep 1997 22:24:58 +0000
From: Fred <Fred@nospam.com>
To: mark@pbi.net
Subject: Re: Incredibly basic Newbie question
Message-Id: <34147B33.7262@nospam.com>

Mark Tripod wrote:
> 
> Get the book "Learning Perl on Win32 Systems" aka "the Gecko book" by
> Randal Swartz, Erik Olson and Tom Christansen. It is published by
> O'Reilly and Associates. You should be able to find it in any computer
> book store. Or you can purchase it via the WWW at
> http://www.oreilly.com/publishing/perl/products.htm
> 
> Hope this helps,
> 
> Mark
> 
> Fred wrote:
> 
> > (Can someone point me to a tutorial or book which covers such elementary
> > basics?)


Thanks, Mark!


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

Date: Mon, 08 Sep 1997 22:27:34 +0000
From: Fred <Fred@nospam.com>
Subject: Re: Incredibly basic Newbie question
Message-Id: <34147BD6.64EE@nospam.com>

Mark Tripod wrote:
> 
> Get the book "Learning Perl on Win32 Systems" aka "the Gecko book" by
> Randal Swartz, Erik Olson and Tom Christansen. It is published by
> O'Reilly and Associates. You should be able to find it in any computer
> book store. Or you can purchase it via the WWW at
> http://www.oreilly.com/publishing/perl/products.htm
> 
> Hope this helps,
> 
> Mark
> 
> Fred wrote:
> 
> > (Can someone point me to a tutorial or book which covers such elementary
> > basics?)


Thanks, Mark!  :)


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

Date: Tue, 09 Sep 1997 09:48:30 -0400
From: the count <eglamkowski@mathematica-mpr.com>
Subject: installing perl (problem pinned down, but I still need help...)
Message-Id: <341553AE.6CE3@mathematica-mpr.com>


I figured out my problem in installing perl - the compiler I am using
(SunSoft C++ v4.1) doesn't accept the function syntax used, i.e.:
void
perl_construct( sv_interp )
register PerlInterpreter *sv_interp;
{

is bad.  It *MUST* instead have:
void perl_construct(register PerlInterpreter *sv_interp) 
{


from cc -migration:
        1.3.1   K&R-style function definitions are no longer allowed

        C++ 3.0 issues warnings; C++ 4.1 issues errors.


Anybody know of any trivial or clever way to make this change 
universally in all the .c files?  I'd hate to have to go through all
those files manually... :(

Or is there some option in Configure I can use to deal with this?


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

Date: Tue, 09 Sep 1997 10:14:01 -0400
From: "Shawn M. Worsencroft" <shawn_worsencroft@intercept.com>
Subject: local array in subroutine
Message-Id: <341559A9.7989@intercept.com>

I am trying to make an array local to a subroutine, and return it to
main.  

The code works when the array is left as a global.
It looks something like this.

sub read_configuration {

# code

return( @array )

} # end sub

This works fine, but if I try to make the declaration my @array at 
the beginning of the sub routine it does not.  My understanding is that
arrays get returned as lists and I don't understand why there is a
difference when a local array is implemented.  Please explain.

-- 
------------------------------------------------------------------------
     _/_/_/  _/_/_/_/_/  _/_/_/  Shawn Worsencroft
      _/        _/        _/     Electrical Engineer
     _/        _/        _/      Intercept Technology Inc.
    _/        _/        _/       shawn_worsencroft@intercept.com
   _/        _/        _/        (404) 352-0111 ext. 20 (tel) 
_/_/_/      _/      _/_/_/       (404) 352-3744 (fax)  www.intercept.com


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

Date: 9 Sep 1997 15:08:41 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: local array in subroutine
Message-Id: <5v3opp$isp@news-central.tiac.net>

In article <341559A9.7989@intercept.com>,
Shawn M. Worsencroft <shawn_worsencroft@intercept.com> wrote:
>I am trying to make an array local to a subroutine, and return it to
>main.  
>
>The code works when the array is left as a global.
>It looks something like this.
>
>sub read_configuration {
>
># code
>
>return( @array )
>
>} # end sub
>
>This works fine, but if I try to make the declaration my @array at 
>the beginning of the sub routine it does not.  My understanding is that
>arrays get returned as lists and I don't understand why there is a
>difference when a local array is implemented.  Please explain.

How do you assing the results when you call &read_configuration?  Are you
relying on it setting the global @array as a side effect, in which case
localising it will have an effect.

  @array = &read_configuration;

would be the way I retrieved the results, but without more code it's hard
to guess what's going on...

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Tue, 9 Sep 1997 06:11:50 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Brett Denner <Brett.W.Denner@lmtas.lmco.com>
Subject: Re: Minimizing Memory Needed for Numbers Read from Binary Files
Message-Id: <Pine.GSO.3.96.970909060319.27604H-100000@julie.teleport.com>

On Mon, 8 Sep 1997, Brett Denner wrote:

> That seems like a lot of overhead, but maybe its necessary because 
> of the inner workings of Perl.  Does anyone have any thoughts?

As Ilya has pointed out, Perl could do better in some ways. But if you're
wanting to work with lotsa numbers, you may want to check out the PDL
modules. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 9 Sep 1997 11:59:44 -0400
From: k96rk01@cc.kzoo.edu (Robert J. Kent)
Subject: Re: perl win32 compiler???
Message-Id: <5v3rpg$o8t$1@henson.cc.kzoo.edu>


>Does anyone know if there is any Perl for WIN32 compiler??
>If not , can you help me in compiling a Perl script inside a wrapper of
>C or C++

yes, there is one, and i use it myself; a good place to get a list of
download sites is:

http://language.perl.com/info/software.html

-rob kent


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

Date: Tue, 9 Sep 1997 12:42:30 GMT
From: Carry Megens <Carry.Megens@nym.sc.philips.com>
To: Sascha Kerschhofer <e9127005@stud1.tuwien.ac.at>
Subject: Re: pipe in the mailer
Message-Id: <34154436.66D@nym.sc.philips.com>

Sascha Kerschhofer wrote:
> 
> i can mail messages with the mailer by opening a filehandle.
> open (MAIL, "|usr/bin/mail asd@akjsd.net");
> then i am mailing the text with the print command. i print:
> 
> From: myadress
> Subject: my sybject
> And here i am mailin the message
> 
> but: how can i divide the header (subject, from..) from the message
> itself? if i do it in the way i showed, alle the message remains in the
> Subject when reading the mail in x-mailers like Eudora. is there any
> character which divides the header from the message?
> any help is appreciated!
> 
> Sascha Kerschofer, Vienna

Try a newline! Look at the RFC docs about SMTP.
-- 
Carry Megens           Designflow Services  M 2.039        !!!
Philips Semiconductors Consumer IC                        (0o0)
Gerstweg 2             6534 AE Nijmegen                    \U/
Nijmegen               the Netherlands
talkto: +31-24-353 3590
seri  : nymegens@nyhp03
mailto:Carry.Megens@nym.sc.philips.com
http://cicc06.nym.sc.philips.com:8080/~nymegens


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

Date: Tue, 09 Sep 1997 10:08:39 -0400
From: Stephen Hill <buck@huron.net>
Subject: Print an Image
Message-Id: <34155860.818020B9@huron.net>


Can you have a PERL script output an image? If so how do you do it?

I have tried many ways, but still cannot accomplish this :-( Any help
would be appreciated.

buck@huron.net
Thanks...




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

Date: 9 Sep 1997 14:16:28 GMT
From: jgloudon@bbn.com (Jason Gloudon)
Subject: Re: Q: bitwise operators and perl
Message-Id: <5v3lns$hec$1@daily.bbnplanet.com>

In article <3414D6AF.57B47944@plain.co.nz>,
Cameron Hart  <cam@plain.co.nz> wrote:
>Hi, I am wondering if anyone can help me with perl bitwies operations
>
>My senario is I have an array of an array of two 32 bit unsigned
>integers that I get from a database. An individual record looks
>something like this
>
>$ARRAY[0] = [
>          '3391401472',
>          '4294967040'
>        ];
>
>I am trying to make a match with a given 32 bit unsigned integer going
>through the entire array trying this (where $number = 3391401473):
>
>if (($ARRAY[$i][1] & $addr) == $ARRAY[$i][0]) { do something interesting
>};
>
>If you perform an & on these numbers, like I tried in the perl debugger
>you should get 
>
>(4294967040 & 3391401473) = 3391401472
>
>which would be a match. But for some reason 
>
>($ARRAY[$i][1] & $addr) = 1243917825

This got me a few weeks ago. The & operator in perl5 does a character by 
character bitwise & of two scalars as strings if you give it two scalars.
Try this :
($ARRAY[$i][1] & ($addr | 0)) = 1243917825

The or with 0 makes the right hand side of & look like a number instead of
a string so perl will do what you expect (based on the perlop manpage in 5.003)


Jason Gloudon


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

Date: Tue, 9 Sep 1997 07:59:33 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Geoffrey Leach <geoffrey@iname.com>
Subject: Re: Q: HOWTO - Manifest Constants
Message-Id: <Pine.GSO.3.96.970909075726.27604I-100000@julie.teleport.com>

On Mon, 8 Sep 1997, Geoffrey Leach wrote:

> Call me a throwback, but "$TRUE" bothers me.  It used to be that the
> following was the reccomended way of having a manifest constant,
> but this seems not to work anymore.  Any suggestions, short of
> creating an extension?  Version is 5.004

    use constant TRUE => 1;	# If you must... :-)

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 09 Sep 1997 07:19:54 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Regexp a Yes or No question?
Message-Id: <m3g1rey3g5.fsf@windlord.Stanford.EDU>


Sylvain St Germain <sgermain@nortel.ca> writes:

> How do you regexp the answer to 
> a yes or no question?

> I mean Y, y, yes, Yes, YES, YEs, yES, 
> OK, ok, Ok, oK, true, TRUE ... 

> and

> No, no, No, nO....

Give them a prompt like:

        Do you want to destroy the world (yes/no)?

and then use code like:

        $answer = <STDIN>;
        if ($answer =~ /^y/i) {
            system 'skill', 'xearth';
        } else {
            print "The world is safe!\n";
        }

The number of people who, when presented with a prompt ending in (yes/no),
enter something other than "yes", "y", "no", or "n" with some
capitalization is too small to worry about as far as I'm concerned.  Even
computer novices tend not to do those sorts of strange things.

-- 
#!/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: 09 Sep 1997 16:19:47 +0300
From: matti@universe.pc.helsinki.fi (Matti Kinnunen)
Subject: Re: Regexp a Yes or No question?
Message-Id: <lzyb56r5e4.fsf@universe.pc.helsinki.fi>


In article "Sylvain St.Germain" writes:

   How do you regexp the answer to 
   a yes or no question?

What about:

# ask a yes/no question and return 1 or 0 accordingly
sub yesno {
    my ($prompt,$answer) = (@_) ;
    ASK: {
        print $prompt, "[y/n] ?" ; 
        $answer = scalar(<STDIN>);
        redo ASK unless $answer =~ /^[yotn]/i ;  
    } 
    $answer =~ /^[yot]/i ;
}

-- 
* matti.kinnunen@helsinki.fi *
* http://universe.pc.helsinki.fi/~matti/contact.html *
* +358-(0)40-593 50 91 but try first +358-(0)9-191 23978 *


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

Date: Tue, 09 Sep 1997 15:51:28 +0100
From: James Hunt <jhunt@mltsa.uk.lucent.com>
Subject: removing shell comments from ksh scripts
Message-Id: <34156270.506F1420@mltsa.uk.lucent.com>

This is a multi-part message in MIME format.
--------------2BFF8D90CA8F77A200AA39A3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Does anybody know of a reliable way/have a program to remove comments
from ksh scripts?

This should have been a simple C program, but the problem I'm up against
is how to handle lines like this...

k=${j##*/}	# comment

 ...where the program has to know that the 1st hash isn't a comment
character.

If you can help, please mail me at jameshunt@lucent.com.

Thanks,

James
-- 
_____________________________________________________________________
Home Page -          http://tms.uk.lucent.com/~jhunt/
Sablime/Volume FAQ - http://tms.uk.lucent.com/~jhunt/sab+vol_faq.html
--------------2BFF8D90CA8F77A200AA39A3
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for James Hunt
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             James Hunt
n:              Hunt;James
org:            Lucent Technologies Network Systems UK Ltd
adr:            Lucent Technologies;;Swindon Road;Malmesbury;Wiltshire;SN16 9NA;England
email;internet: jhunt@mltsa.uk.lucent.com
title:          Software Engineer
tel;work:       +44 1666 832981
tel;fax:        +44 1666 832844
note:           Sablime and Volume Administrator, Application Support
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------2BFF8D90CA8F77A200AA39A3--



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

Date: Tue, 09 Sep 1997 12:02:08 -0500
From: Gary Fontenot x34237 <Gary.P.Fontenot1@lmtas.lmco.com>
Subject: Sending a file with mailx using perl
Message-Id: <34158110.4571@lmtas.lmco.com>

Hello

Here's a question about how to use a shell command in perl.

I want to send the contents of a file ($myfile) in a mail message.
Since it seems that mailx does not directly provide the
ability to do that, the following command with /bin/ksh has
been used:

<$myfile mailx -s "My Subject" $MAIL_RECIPIENT


Why doesn't the following work in perl (it sends a message with
a correct subject, but an empty body ($myfile is missing))?:

system("<$myfile mailx -s 'My Subject' $MAIL_RECIPIENT");


Thanks
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gary P. Fontenot                          |Lockheed Martin TAS
Gary.P.Fontenot1@lmtas.lmco.com           |P.O. Box 748
(817) 763-4237                            |Mail Zone 5845
                                          |Ft. Worth, TX 76101

"Zathras warn, but no, nobody listen to poor Zathras, no..."


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

Date: 9 Sep 1997 13:53:39 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Syntax of SEARCHLIST in tr?
Message-Id: <5v3kd3$f0u@news-central.tiac.net>

In article <Pine.A41.3.95a.970908220930.111812P-100000@sp065>,
Alan J. Flavell <flavell@mail.cern.ch> wrote:
>
>
>I'm finding the perlop section about the syntax of the tr searchlist is
>somewhat vague.  Are there any characters that have a special meaning in
>this context?  From the examples it seems "yes", since "-" at least is
>playing a special role in "a-z" etc.  OK, then how does one specify a
>"-" literally in such a list?  And what other characters, if any,
>play a special role and how does one escape them?  This isn't "regular 
>expression" syntax, is it?  Where have I failed to find it documented?
>Perl is usually so good about documenting things, but I only realised I
>hadn't understood this when I tried to use tr in some ways that I 
>hadn't done before.
>
>OK, let's take one specific example: to filter an arbitrary string
>leaving only alphabetic characters and hyphens.  Is it tr/a-zA-Z-//cd 
>or what?  That seems to work, but... 

Jeffrey Friedl's book, Mastering Regular Expressions (see
http://www.ora.com/catalog/regex/ ) makes the point that the language used
to specify character classes is a special language which is different from
the rest of the regex language (but he says it better and my copy's at
home...)  The first argument to tr is effectively a character class
specification, so it's roughly a list of characters or character ranges.
The - can be a part of a range specification only if it's between two
characters, so if it's at the beginning or end of first argument in the
tr/// then it means -.  Octal \nnn escapes work in tr ranges.  Friedl's
book is the place to look.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 09 Sep 1997 15:27:26 +0300
From: Antti Rauramo <arauramo@alpha.hut.fi>
Subject: Um... a bug?
Message-Id: <j3eg1re65ap.fsf@alpha.hut.fi>


	Hello.

	As far as I can see, the following program displays a very
obvious bug in Perl. Tell me if I'm wrong. 
	Works (doesn't work, that is to say) at least with Perl
versions 5.004_01 and 5.003 in SunOS 5.5 and OSF1 v4.0.

--- 8< --- clipety clap --- 8< ---
#!/usr/local/bin/perl

for($i=1;$i<7;$i+=0.1){
    print "$i\t".int($i)."\n";
}
--- 8< --- clipety clap --- 8< ---


Antti Rauramo |   In a Rhodes tailor shop: Order your summers  suit.  Because
arauramo@     | is big rush we will execute customers in strict rotation.
    cc.hut.fi |  
0422 - 326 311|  


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

Date: 9 Sep 97 14:49:06 GMT
From: rpete@ascda3.harvard.edu (Pete Ratzlaff)
Subject: Re: Um... a bug?
Message-Id: <341561e2.0@cfanews.harvard.edu>

Antti Rauramo (arauramo@alpha.hut.fi) wrote:

> 	As far as I can see, the following program displays a very
> obvious bug in Perl. Tell me if I'm wrong. 
> 	Works (doesn't work, that is to say) at least with Perl
> versions 5.004_01 and 5.003 in SunOS 5.5 and OSF1 v4.0.

> #!/usr/local/bin/perl

> for($i=1;$i<7;$i+=0.1){
>     print "$i\t".int($i)."\n";
> }

Are you referring to the fact that it prints 5 and 4,
6 and 5, and 7 and 6 next to each other? If so, use

printf "%.19f\t%d\n",$i,int($i);

instead of your print statement to see why. If not,
then you should state what bug you think you're seeing.

-------------
Peter Ratzlaff                    Harvard-Smithsonian Center for Astrophysics
Office B102                       60 Garden St, MS 21, Cambridge MA 02138 USA
<pratzlaff@cfa.harvard.edu>       phone: 617 496 7714


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

Date: 09 Sep 1997 10:33:55 -0400
From: Douglas McNaught <doug@tc.net>
Subject: Re: Um... a bug?
Message-Id: <m2bu22o8to.fsf@ono.tc.net>

Antti Rauramo <arauramo@alpha.hut.fi> writes:

> 	As far as I can see, the following program displays a very
> obvious bug in Perl. Tell me if I'm wrong. 
> 	Works (doesn't work, that is to say) at least with Perl
> versions 5.004_01 and 5.003 in SunOS 5.5 and OSF1 v4.0.
> 
> --- 8< --- clipety clap --- 8< ---
> #!/usr/local/bin/perl
> 
> for($i=1;$i<7;$i+=0.1){
>     print "$i\t".int($i)."\n";
> }
> --- 8< --- clipety clap --- 8< ---

Looks normal to me (Linux, Perl 5.003).  Floating point numbers are
not infinitely precise.

-Doug
-- 
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";


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

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

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