[7624] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1250 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 30 15:17:09 1997

Date: Thu, 30 Oct 97 12:00:44 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 30 Oct 1997     Volume: 8 Number: 1250

Today's topics:
     Re: $1000/wk Donating Sperm <BITNET@QZ.LITTLE-NECK.NY.US>
     Re: 2038 problem, was Re: Year2000 problem with localti (John Moreno)
     Re: ANNOUNCE: IndexMaker 2.0: an index.html maker from  <dparrott@ford.com>
     Re: CGI script results to email? <Jan@chipnet.cz>
     Debugger eats $! (Tye McQueen)
     Re: Eval and use proplem (Honza Pazdziora)
     Re: Eval and use proplem <k.mueller@intershop.de>
     Re: Execution time in Perl (Mick Farmer)
     File handling and arrays <sps196@ecs.soton.ac.uk>
     Re: File Locking? <VikR@aol.com>
     Re: File Locking? (Tad McClellan)
     Help want to create a Perl script executable for Win95 (Licensed User)
     How best to do local Perl library? <g_sinclair@fujitsu-fnc.com>
     How do I do multiple require's in different packages <sherman@unx.sas.com>
     if (0<= $hun < 250) doesn't compile <gennari@slac.stanford.edu>
     Re: JavaScript document.write from Perl script (Steve Grantz)
     Newbie Q: read and append file question (Hans Malmberg)
     Re: Newbie Q: read and append file question (Lena Mindlina)
     Re: Newbie Q: read and append file question (Tad McClellan)
     PERL compiler for DOS <RANCZ@ludens.elte.hu>
     Re: Perl's Gurus and Alfa geeks <usenet-tag@qz.little-neck.ny.us>
     Re: Reading a Binary file. (Mick Farmer)
     returning a filhandle from xsub <peter@kkcc.demon.co.uk>
     Scalars containing back references and regular expressi <bobh@metrica.co.uk>
     Strings, parameters & Makefiles paul@pkamf.demon.co.uk
     Telling Whether a Wildcarded Regular Expression Will Ma (Kevin M Simonson)
     Re: Telling Whether a Wildcarded Regular Expression Wil (Tad McClellan)
     Re: Use perl from Visual Basic (Licensed User)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 30 Oct 1997 19:16:50 GMT
From: B1FF <BITNET@QZ.LITTLE-NECK.NY.US>
Subject: Re: $1000/wk Donating Sperm
Message-Id: <eli$9710301410@qz.little-neck.ny.us>

In article <291097170021@louis.com>,  <chico@louis.com> wrote:
> visit  http://281.252.551.602/index.html   for more detailed information on how you can partake in the sperm donor program.
> 
> 



=>><>=><=>>=<====<<<

WOW. ID LOVE 2 B A SPURM DONOR! THEN PURL COULD PROCESZ MY DNA
4 THE D00D GENUM PROJECT, THAT WOULD B C00L!!1!

==========>>>>> B!FF!!!!!!!!!!!!!!!!!!!!!!!!<<<<<<<============
======


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

Date: Thu, 30 Oct 1997 12:37:45 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: 2038 problem, was Re: Year2000 problem with localtime();
Message-Id: <1997103011070225189520N@roxboro-170.interpath.net>

Alan J. Flavell <flavell@mail.cern.ch> wrote:

] I really didn't know what to do with the Subject - it's infuriating to
] see "Year2000 problem" over and over when in fact there isn't one! I
] was tempted to change it to "Year2000 non-problem"...
] 
] On Wed, 29 Oct 1997, John Moreno wrote:
] 
] > Well, using MacPerl 2038 is fine but there is a problem with 2040 -
] > in any case we have 40+ years to deal with the problem and most
] > systems are beginning to go to a 64 bit system, this will probably
] > be complete within 15 years.
] 
] But that assumes that people only want to compute dates beyond 2038 
] when we get there.  That seems to me an unreasonable assumption, in
] general.  Consider, for example, people starting their first job now,
] and doing calculations relating to their pension entitlement.

True, and I hadn't thought of it - but I don't see this as a big
problem.  If a programmer is doing work along those lines they can
always do the calculations personally - i.e. write a version of
localtime that works with larger numbers, in perl it should be dead easy
since it already uses larger numbers.

-- 
John Moreno


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

Date: Thu, 30 Oct 1997 11:35:16 -0500
From: "Dennis M. Parrott" <dparrott@ford.com>
To: Jason Gloudon <jgloudon@bbn.remove.com>
Subject: Re: ANNOUNCE: IndexMaker 2.0: an index.html maker from PDF, HTML and other files
Message-Id: <3458B744.1C41@ford.com>

Jason Gloudon wrote:
> 
> Fabrizio Pivari (pivari@geocities.com) wrote:
> : Hi,
> 
> : I'm glad to announce the version 2.0 of IndexMaker a perl script to make
> : an index.html file from PDF, HTML and other files.
> : At the moment, it uses the /Author field and the first /Title field in
> : every matched PDF files, the <TITLE> </TITLE> field in every matched
> : HTML files and the name of the file in the others.
> : It should work with PERL 4 and 5.
> 
> : What's new with version 2.0
> : New input files format: HTML, OTHER
> 
> : This is the URL where you can find the tool
> : http://www.geocities.com/CapeCanaveral/Lab/3469
> 
> : Enjoy it!
> 
> : Send me your suggestions.
> 
> Post this to the correct newsgroup comp.lang.perl.announce :).
> 
> Jason Gloudon

Jason - HE DID.

IndexMaker 2.0 *processes* information contained in a PDF file so
you can get an 'automagic' index page. Since it uses PDF files
as input, I think that is 'close enough for horseshoes'.

If it works as advertised, I am sure that people will find it 
useful. (I'll probably report back on it after I try it out.)

Personally, I wish people who wrote tools to process PDF files
would *always* post here as I have a very short list of NGs
I follow with any regularity.
-- 

-----------------------------------------------------------------------------
Dennis M. Parrott             |            Unix: 
parrott@ped.pto.ford.com
PCSE Webmaster                |           PROFS:  DPARROTT
Ford Motor Company            |             VAX:  EEE1::PARROTT
Dearborn, Michigan USA        | public Internet:  dparrott@ford.com
-----------------------------------------------------------------------------
Email is best, but voice: 313-322-4933 fax: 313-323-6743 pager:
313-201-9978


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

Date: Thu, 30 Oct 1997 20:10:29 -0800
From: Jan Krynicky <Jan@chipnet.cz>
To: chris_braiotta@harvard.edu, neil@pacifier.com
Subject: Re: CGI script results to email?
Message-Id: <34595A35.1516@chipnet.cz>

Chris Braiotta wrote:
> 
> Neil Anuskiewicz wrote:
> 
> > <snip>
> 
> > I need to write a cgi script that creates a form on our web site that
> 
> > someone can fill out, submit, and then the results sent in an email. The
> > email goes to several people so it must retain an easily readable
> > format:
> 
> <snip>
> 
> You didn't mention what OS you're running on. It's easy in UNIX, not so
> easy on mac...
> 
> Chris Braiotta
> chris_braiotta@harvard.edu

If you use some socket() based module instead of some
external program you do not have to care about OS.
Any port of Perl supporting socket()s is OK.

See http://www.chipnet.cz/depot/perl.htm
 (Mail::Sender.pm or SendMailEx.pm)

Jenda


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

Date: 30 Oct 1997 13:33:44 -0600
From: tyde@medtrodnet.cdom (Tye McQueen)
Subject: Debugger eats $!
Message-Id: <63aneo$isk@fiinix.metronet.com>

Why does the command:

    DB<1> warn "Simple warning!\n"

produce the over-kill output of:

    Simple warning!
	    eval '($@, $!, $,, $/, $\\, $^W) = @saved;package main; $^D = $^D | $DB::db_stop;
    warn "Simple warning!\\n";

    ;' called at /usr/local/lib/perl5.004/lib/perl5db.pl line 1153
	    DB::eval called at /usr/local/lib/perl5.004/lib/perl5db.pl line 1062
	    DB::DB called at -e line 1

Are there cases where this is actually desirable?  (This is Perl5.004_01
under HP/UX and Windows NT, at least.)  I realize it is desirable for
debugging modules, but can we avoid this in the debugger's eval code?

I think this goes to the problem I wasted some time debugging.
The debugger eats the value of $!.  My XS-base module goes to the
trouble of setting $! to sensible values.  It is very handy to
go along in the debugger using my routines like so:

      DB<7> p RegOpenKey(HKEY_LOCAL_MACHINE,"SomeDumbKey",$hKey)
    0
      DB<8> p "Reason for failure is NOT: $!."
    Reason for failure is NOT:
      DB<9>

without having to resort to:

      DB<9> RegOpenKey(HKEY_LOCAL_MACHINE,"SomeDumbKey",$hKey) or print "$!\n"
    The system cannot find the file specified

just so I know why the call failed.

Having `warn' output less cluttered is not important to me
compared to having $! preserved across debugger input lines.

Thanks,
--
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
       Remove d's from address to reply (sorry for the inconvenience).


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

Date: Thu, 30 Oct 1997 17:00:25 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Eval and use proplem
Message-Id: <adelton.878230825@aisa.fi.muni.cz>

Klaus Mueller <k.mueller@intershop.de> writes:

> Hello,
> 
> I have a problem using "eval" and "use" together.
> 
> First a small code example:
> Script (extract):
> ---
> $a = "use Test; Test()";
> eval $a;
> warn $@ if $@;
> ---
> Test.pm:
> ---
> package Test;
> require 5.001;
> require Exporter;
> 
> @ISA = qw(Exporter);
> @EXPORT = qw(Test);
> 
> sub Test {
>   print "Hallo\n";
> }
> 
> 1;
> ---
> The script is running within a long living process. It's executed on a
> special condition.
> The first time it's printing "Hallo". Sometime later I change the
> Test.pm module (print "Hallo 2\n";). But the next time the script is
> executed it also print "Hallo" and not "Hallo 2" as expected.
> 
> Question: How to reload a module after a change using "use"?

delete $INC{'Test.pm'};

Check perlfunc, part use, part require.

Hope this helps,

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


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

Date: Thu, 30 Oct 1997 19:01:27 +0100
From: Klaus Mueller <k.mueller@intershop.de>
Subject: Re: Eval and use proplem
Message-Id: <3458CB77.B30B8B2E@intershop.de>

Thanks,

I now it's working correct.

Solutions:
I store the %INC hash before running the eval and rewrite it after the
evel.

Bye
Klaus


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

Date: Thu, 30 Oct 1997 17:41:49 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Execution time in Perl
Message-Id: <EIvL5p.63G@mail2.ccs.bbk.ac.uk>

Dear Eddy,

Try the Benchmark module in the standard library.  This
should do what you want.

Regards,

Mick


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

Date: Thu, 30 Oct 1997 18:15:08 +0000
From: Sam Stickland <sps196@ecs.soton.ac.uk>
Subject: File handling and arrays
Message-Id: <3458CEAB.FB3CE119@ecs.soton.ac.uk>

Hi,

I'm new to perl so be gentle - or rather don't laugh too much...

I've written a simple Perl script that handles membership records.

A typical file layout is shown below (stored in ACSII text format):

BEGIN MEMBERSHIP RECORD
Date:Fri Oct 24 18:05:05 GMT 1997
Status:Pledge
Name: Samuel Stickland
UserName:Sam
eMail:sps196@ecs.soton.ac.uk
Street1:7 Woodcote Road
Street 2:Swaythling
Street 3:
City:Southampton
State:
Zip:SO17 3TA
Country:UK
Phone:(UK) 01703 488482
END MEMBERSHIP RECORD

It's designed to be easily readable, hence the large amount of redunant
information.

Assume for now that I'm just splitting this into key and value, based on
the first colon.

Question is, how would I read in a file, containing many records like
the above into an array/list that contains the information on two
levels.

In C I'd create a linked list of structures, with each structure
containing pointers to strings for the membership information.  What's
the equivalent logical way of handling this in Perl?

Example code, or just some plain hints for this somewhat newbie question
would be appreicated.

Obviously I'd prefer replies via email (wouldn't we all?) but replies
here are just fine..

Sam



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

Date: Thu, 30 Oct 1997 10:17:54 -0800
From: Vik Rubenfeld <VikR@aol.com>
To: Tad McClellan <tadmc@flash.net>
Subject: Re: File Locking?
Message-Id: <3458CF4F.5832B661@aol.com>

Thanks very much for this feedback!

> 24 lines above where that subroutine is given in the perlfunc man page
> it says:
> 
>    "If LOCK_NB is added to LOCK_SH or LOCK_EX then flock()
>     will return immediately rather than blocking waiting for the lock"

I must not have the same copy of the manpage as you do. I just downloaded the
perlfunc manpage at <http://www.ece.concordia.ca/ece/doc/perl/perlfunc.html>
and searched for that text, but it was not found. Where can I get the
documentation you are referring to?

>: - What happens if someone tries to write to an Flocked file? 

> They write to it just fine. The same as if it was not flock()ed.

Really? If somebody else's app tried to access a file I had flocked, they
could write to it even while my app thought it was locked? 

> flock() is *advisory*. It is up to the programs that access the file
> to cooperate in the locking...

Oh, okay. Since only instances of my PERL program will be accessing the file,
that should work. And all I have to do to cooperate in the locking is to call
flock after opening the file, and before reading from or writing to it, am I correct?

Your advice is very much appreciated.

- Vik


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

Date: Thu, 30 Oct 1997 14:04:20 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: File Locking?
Message-Id: <48pa36.62c.ln@localhost>

Vik Rubenfeld (VikR@aol.com) wrote:
: Thanks very much for this feedback!

: > 24 lines above where that subroutine is given in the perlfunc man page
: > it says:
: > 
: >    "If LOCK_NB is added to LOCK_SH or LOCK_EX then flock()
: >     will return immediately rather than blocking waiting for the lock"

: I must not have the same copy of the manpage as you do. I just downloaded the
: perlfunc manpage at <http://www.ece.concordia.ca/ece/doc/perl/perlfunc.html>
: and searched for that text, but it was not found. Where can I get the
: documentation you are referring to?


The one that came with 5.004_01


: >: - What happens if someone tries to write to an Flocked file? 

: > They write to it just fine. The same as if it was not flock()ed.

: Really? If somebody else's app tried to access a file I had flocked, they
: could write to it even while my app thought it was locked? 


You got it!

If they don't try to flock() it first, they can stomp all over what
your well-behaved flock()ing program is doing...

[it is easy enough to try out yourself, write a script that flock()s
 and sleeps for say, 30 seconds. Write a second script that just writes
 to the file. Run the second one in the 30 second window of the first
 one...
]

: > flock() is *advisory*. It is up to the programs that access the file
: > to cooperate in the locking...

: Oh, okay. Since only instances of my PERL program will be accessing the file,
: that should work. And all I have to do to cooperate in the locking is to call
: flock after opening the file, and before reading from or writing to it, am I correct?

You got it again. I'm sensing a trend...   ;-)

(always remembering to never unlock the file, just close() it)


: Your advice is very much appreciated.


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Thu, 30 Oct 1997 12:00:13 -0500
From: hobo@alumni.stanford.org (Licensed User)
Subject: Help want to create a Perl script executable for Win95
Message-Id: <MPG.ec2872999a355e9989685@news.ricochet.net>

Can anyone help me create a perl script executable for win95... I've seen 
Malcolm Beattie's directory on www.perl.com but I didn't see anything 
regarding a Windows solution....  Is there anyone out there who can help 
me... or direct me to a link that can help me?

thanks
Stan


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

Date: Thu, 30 Oct 1997 11:04:05 -0600
From: Greg Sinclair <g_sinclair@fujitsu-fnc.com>
Subject: How best to do local Perl library?
Message-Id: <3458BE05.C9841337@fujitsu-fnc.com>

Hello All,

I have a need to install a few perl modules and have run into a problem.
My sysadmin won't give me permission to install them in the global
perl library where all the existing modules are installed. 

How can I create a local perl library in my home space
(/home/user/..???)
that I can easily acces with just one '-I' option?  

I currently have DateCalc install in the following location:
        /home/user/perl/lib/DateCalc.

To reference in a script I have to do:
        /perl -I/home/user/perl/lib/DateCalc-3.0/blib/arch      
              -I/home/user/perl/lib/DateCalc-3.0/blib/lib

This does not seem right to be. It seems like an awful lot of '-I's
if there are many modules install.

Can anybody help a library/module newbie?

Thanks
Greg


-- 
------------------------------------------------------------------------
Greg Sinclair                                      voice : (972)479-3846
Sr. Hardware Designer                              fax   : (972)479-2666
Fujitsu Network Communications         mailto:g_sinclair@fujitsu-fnc.com
------------------------------------------------------------------------


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

Date: Thu, 30 Oct 1997 12:39:16 -0600
From: Chris Sherman <sherman@unx.sas.com>
To: sherman@unx.sas.com
Subject: How do I do multiple require's in different packages
Message-Id: <878235603.24920@dejanews.com>

I have a file full of constants I want my all my different packages
to see.

The problem is that if I do a
   require constants;
in the main package, I can't do another "require constants;" anywhere
else.  (Require only let's you load a file once).

But I want the constants to be visible to all the different packages, and
doing things like $main::true (instead of just $true) is messy.

Here is an example:

vvv   file: constants.pm  vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
*true = \1;
*false = \0;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
vvv   file: foo.pm  vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
package foo;
require constants;
sub doit {
   print "in foo: true is $true    false is $false\n";
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

vvv   file: bar.pl  vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
#!/usr/local/bin/perl5
package main;
require constants;
require foo;
print "in main: in foo: true is $true    false is $false\n";
&foo::doit;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Then to run it:

% bar.pl
in main: in foo: true is 1    false is 0
in foo: true is     false is

In package foo, it didn't see the constants.

Any ideas???

Thanx!!! --  ____/  /  /  __  /  _  _/	____/  /  /  /	/  /  /  /  Chris
Sherman  /  ___  /  _/	/  /  _____/  __/  __/	__/ _\	_____/	_____/ 
sherman@unx.sas.com

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


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

Date: Thu, 30 Oct 1997 11:42:46 -0800
From: "l. trindle gennari" <gennari@slac.stanford.edu>
Subject: if (0<= $hun < 250) doesn't compile
Message-Id: <3458E336.167E@slac.stanford.edu>

Hi gang-

I have a section of a script that's giving me the blues. Here 'tis:

if (0 <= $hun < 250) {
    $division = $thou."000";
    }
elsif (250 <= $hun < 500) {
        $division = $thou."250";
    }
elsif (500 <= $hun < 750) {
    $division = $thou."500";
}
else {
    $hun = $thou."750";
}

It doesn't seem to like my <=. Any clue why this doesn't work?


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

Date: 30 Oct 1997 19:29:58 GMT
From: sgrantz@visi.com (Steve Grantz)
Subject: Re: JavaScript document.write from Perl script
Message-Id: <63an7m$6oo$1@darla.visi.com>

Michael Morrison (mmorrison@vnet.ibm.com) wrote:
: I've been trying to issue JavaScript document.write() statements from a 
: Perl script, 
: but without success. Can it be done?  If so how? 
: 
: I did print the <SCRIPT> tag, and because of JavaScript syntax checking,
: I know the browser is parsing the JavaScript of the Perl-generated page, 
: but document.write is ignored.  

JavaScript is executed on the client side, just as html tags are 
interpreted by the client. Therefore your perl should just print
out the document.write commands as text, rather than try to interpret
them as instructions.

It's as if you are writing a recipe. You don't want perl to try to 
seperate two eggs, you want it to print "seperate two eggs."

For an example, this little bit of perl should work inside your code:

print "My server has time" . localtime . "<br>\n";
print <<"ENDSCRIPT";
      <script language="JavaScript">
         document.write('Your client's time is ' + Date() + '.<br>');
      </script>
ENDSCRIPT

-g
      


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

Date: Thu, 30 Oct 1997 18:23:17 +0100
From: hansmbg@algonet.se (Hans Malmberg)
Subject: Newbie Q: read and append file question
Message-Id: <199710291929061905140N@du172-150.ppp.algonet.se>

I have to create a file build up in three steps.
1. I create the first file
2. I create the second file
3. I want to append the second file with the content of the first one.

open(TEMPOFILE,">$filename1");
   compute some data and
printf TEMPOFILE ("%s\n%.4f * %.2f = %.2f.bla.bla.bla");
   close the file
close(TEMPOFILE);

after that I use some of the computed data and

open(FILE2,">$filename2");
   compute some data and
printf FILE2 ("%s\n%.4f * %.2f = %.2f.bla.bla.bla");
   close the file
close(FILE2);

My question is which ( how to do?) method to use to
append TEMPOFILE as the latter part of FILE2. 
I'm uncertain of how to read from one file and write
to another file at the same time.

Thank you for your time. I have a sense this is a simple one...
-- 
/Hans   ---   LUND   13.10'30(E   55.43'24(N


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

Date: 30 Oct 1997 18:56:10 GMT
From: mindlina@allegro.cs.tufts.edu (Lena Mindlina)
Subject: Re: Newbie Q: read and append file question
Message-Id: <63al8a$c68$1@news3.tufts.edu>

: My question is which ( how to do?) method to use to
: append TEMPOFILE as the latter part of FILE2. 
: I'm uncertain of how to read from one file and write
: to another file at the same time.

you can copy the contents of TEMPOFILE into a array
then you can open the FILE2 for append by
open(FILE2, ">>file2name");
and then append the array that contains TEMPOFILE to FILE2 by
print FILE2 @array;

this is the first thing that came to mind...but I guess it should 
be possible to dot his without the intermediate clumsy array...
what happens if you try to have multiple filehandles (ofcourse,
reopening FILE2 filehandle for append) and doing something like:

close(FILE2);       #for when it was opened for reading only
open(FILE2, ">>file2name) || die; 
while (<TEMPOFILE>) {
print FILE2 $_;
}

hope this hepls...

--
Lena Mindlin   | A limerick packs laughs anatomical
mindlina@      | Into space that is quite economical.
eecs.tufts.edu | 	But the good ones I've seen
               | 	So seldom are clean,
               | And the clean ones so seldom are comical.


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

Date: Thu, 30 Oct 1997 13:54:33 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Newbie Q: read and append file question
Message-Id: <ploa36.20c.ln@localhost>

Hans Malmberg (hansmbg@algonet.se) wrote:
: I have to create a file build up in three steps.
: 1. I create the first file
: 2. I create the second file
: 3. I want to append the second file with the content of the first one.

: open(TEMPOFILE,">$filename1");
:    compute some data and
: printf TEMPOFILE ("%s\n%.4f * %.2f = %.2f.bla.bla.bla");
:    close the file
: close(TEMPOFILE);

: after that I use some of the computed data and

: open(FILE2,">$filename2");
:    compute some data and
: printf FILE2 ("%s\n%.4f * %.2f = %.2f.bla.bla.bla");
:    close the file
: close(FILE2);

: My question is which ( how to do?) method to use to
: append TEMPOFILE as the latter part of FILE2. 
: I'm uncertain of how to read from one file and write
: to another file at the same time.



open(IN, $filename1) || die "could not open '$filename1'  $!";
open(OUT, ">>$filename2) || die "could not open '$filename2'  $!";
#           ^^
#           ^^ perlfunc man page says under the description of open():

    "If the filename begins with '>>', the file is opened for appending."

while (<IN>) {print OUT} # or even just:     print OUT <IN>;
close(IN);
close(OUT);



: Thank you for your time. I have a sense this is a simple one...


Nearly all "simple ones" can be answered in less that 120 seconds.

No need to post questions like that...

Use the docs that COME WITH the perl distribution.

That is why they are included in the distribution.


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Thu, 30 Oct 1997 20:35:22 +0000
From: Attila Rancz Ede <RANCZ@ludens.elte.hu>
Subject: PERL compiler for DOS
Message-Id: <Pine.VMS.3.91-vms-b4.971030203211.34393A@ludens.elte.hu>

Can anyone show me the way to find a perl compiler to dos.
I would be very pleased for an URL address or just an attachment to a mail.
please mail : RANCZ@STELLA.EOTVOS.ELTE.HU

thanx in advance
Ede

________________________________________________________________________________

		       	     -=<  RANCZ EDE  >=-

	Cim 	:   Baro Eotvos Jozsef Coll. Budapest, Menesi ut 11.-13.
	Tel 	:   209-06-26 
________________________________________________________________________________




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

Date: 30 Oct 1997 19:02:43 GMT
From: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: Perl's Gurus and Alfa geeks
Message-Id: <eli$9710301346@qz.little-neck.ny.us>

Ramon Castillo  <ramon@ramonc.icix.net> wrote:
> I wrote a Perl Script that takes a Config. file  and declares constants
> to any other caller script, it works very well so far, but I wondering
> is is there a more efficient way.

Why not make the config file directly perl executible? Something that
could be use'd, require'd, or eval'ed depending on your wants and/or
needs.

> Plataform Perl 5.000_01 Solaris 2.5

That is fairly old. 

>  while (<CONFIG>){
>        next if (/^#/ || /^\s*$/ ) ;
>        chop ;
>        s/^\s+//g;
>        s/\s+$//g;

Those three lines can be replaced with

	s/^\s+|\s+$//g;

>        $strip = $strip.$_ ;
>       }
>  @strip = split (/;/, $strip);

You won't be able to have ';'s in the values. You could fix this,
but using direct perl code, and letting perl itself parse for you,
is much easier. 

>  foreach $line (@strip) {
>          $line =~ /^([^ ]*): * \(([^ ].*?)\)/;

Have you considered syntax like these?

just:(some,new,york,perl,hackers);	# no space after :

nypm: ();				# This will cause mysterious errors
					# as the [^ ] eats the ) and the
					# .*? \) can't match anything (or eats
					# the next line if the ';' is missing)

NY:PM: (New York Perl Mongers);		# embedded colon

ny.pm: ( new york city,perl maniacs );	# space after paren

>          @{$1} = split (/,/, $2);

No commas will be allowed in values. See above comment on ';'s.

>          if (!$#{$1}) {${$1} = $2};
>         }
>  };1
 
> #!/usr/local/bin/perl
> 
> use Heart::WithBrain;
> while ($god->bless == $Internet && $Perl == $Cool){
>        $Be = "Happy";
>        $Live = "Love";
>        $Hack = "Fun";
> }      #  RC          ray@icix.net

Can't locate Heart/WithBrain.pm in @INC at /tmp/sig line 3.
BEGIN failed--compilation aborted at /tmp/sig line 3.

What can I say? Perl is heartless.

Elijah
------
perl -e 's Y Yreverse q N ny pm ,srekcah lrep kroy wen emosNYex and s Pmp ynP
P and s MsMjust sMx and print and s NYPM MPYN Nis or reverse and print q q q'


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

Date: Thu, 30 Oct 1997 17:46:24 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Reading a Binary file.
Message-Id: <EIvLDC.69z@mail2.ccs.bbk.ac.uk>

Dear Chad,

Have you tried reading the file as follows?

	read FH, $buf, 59;

Regards,

Mick


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

Date: Thu, 30 Oct 1997 19:34:22 -0000
From: "Peter Pickford" <peter@kkcc.demon.co.uk>
Subject: returning a filhandle from xsub
Message-Id: <878240060.22835.0.nnrp-02.c2dec9cf@news.demon.co.uk>

Hi,

I would like to return a file handle from an xsub to perl.

The application I have in mind is an implementation of the C rexec call.

I have tried InOutStream .

The output code for this is

T_INOUT
 {
     GV *gv = newGVgen("$Package");
     if ( do_open(gv, "+<&", 3, FALSE, 0, 0, $var) )
  sv_setsv($arg, sv_bless(newRV((SV*)gv), gv_stashpv("$Package",1)));
     else
  $arg = &sv_undef;
 }

This seems to create a new filehandle in the modules package. Is this used
as a return from the xsub to allow perl to assign this to a FILEHANDLE? e.g.
IO_FILE=rexec(...);

What I want to do is

$stat=rexec($host,$cmd,IO_FILE,ERR_FILE,$user,$passwd);

In xsub how do I place the new file descriptors returned by the c rexec call
into the third and fourth parameters of the xsub?

If I return the file descriptors and use open IO_FILE, "+>&$iofd"; this dups
and the file descriptors increment.

Where do I look for this sort of info? I cant find anything on GV's and
FILEHANDLES.

Any ideas welcome

Thanks

Peter




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

Date: Thu, 30 Oct 1997 13:06:54 -0500
From: Bob Hannaford <bobh@metrica.co.uk>
Subject: Scalars containing back references and regular expressions
Message-Id: <3458CCBE.7535@metrica.co.uk>

I have been trying to do text manipulations using regular 
expressions contained in variables.  I finally managed to get it working
but I don't understand why some methods work and others don't.

Will someone do at least one of the folowing for me:
A) explain why examples 1 to 3 don't work and example 4 does,
B) tell me where I can read up on this stuff,
C) show me a better way of doing it.  (I do need to have the regular
  expressions in variables).

The object of the exercise is to change the character after each
occurenceof 'BOB' in the scalar text2 to something else.

# Example 1
$text2 = 'BOB VHHH   BOB CCCC';
$var1 = 'BOB ([CV])';
$var2 = 'BOB_${1}';
$text2 =~ s/$var1/$var2/eeg;
print 'after text4 '.$text2."\n";

# Example 2
$text2 = 'BOB VHHH   BOB CCCC';
$var1 = 'BOB ([CV])';
$var2 = 'BOB_.${1}';
$text2 =~ s/$var1/${$var2}/g;
print 'after text4 '.$text2."\n";

# Example 3
$text2 = 'BOB VHHH   BOB CCCC';
$var1 = 'BOB ([CV])';
$var2 = 'BOB-.${1}';
$text2 =~ s/$var1/$var2/eeg;
print 'after text4 '.$text2."\n";

# Example 4
$text2 = 'BOB VHHH   BOB CCCC';
$var1 = 'BOB ([CV])';
$var2 = 'BOB_.${1}';
$text2 =~ s/$var1/$var2/eeg;
print 'after text4 '.$text2."\n";

Thanks in advance for your help.
Bob Hannaford
Email: bob.hannaford@adc.metrica.co.uk


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

Date: Fri, 31 Oct 1997 02:17:48 GMT
From: paul@pkamf.demon.co.uk
Subject: Strings, parameters & Makefiles
Message-Id: <878235477.22145.0.nnrp-04.9e98ada2@news.demon.co.uk>

I have two questions:

1) I have a file from which is read a string to compare it to another
string.  
These values get read into an array.  

string1 ab
string2 cd
string3 ef 
string4 ??

ab, cd and ef are the filters.  Now, in string4's case I want ALL
strings to match -ie get everything and filter nothing out.  What
string can I include which when itis array processed and therefore
passed through the filtering algorithm will get amatch against any
other possible string each time? I mean the wildcard default string
that needs to be present to allow the routine to work but which will
get a match every time?

2)I want to run the script under UNIX from a Makefile.  I want to put
parameters in the Makefile that get picked up by the PERL file upon
execution:
i.e.

PARAM1 = NOV
PARAM2 = MON

 ./myPERLprog using PARAM1 and PARAM2

ie in the PERL script I want:

$INTERNALVAR1 = $PARAM1;
$INTERNALVAR2 = $PARAM2;

How can I do this?

thanks

Paul



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

Date: 30 Oct 1997 18:35:55 GMT
From: simonsen_nospam@skopen.dseg.ti.com (Kevin M Simonson)
Subject: Telling Whether a Wildcarded Regular Expression Will Match Any Files
Message-Id: <63ak2b$5gd@sf18.dseg.ti.com>
Keywords: wildcard match

     I have just written a "perl" script that does a bunch of processing on   
a bunch of files that are determined by an argument passed in on the com-
mand line.  In order to process all the files I need to process, I do an
"ls" on a pathname that has a few rigidly defined parts, includes the argu-
ment passed in, and also includes Unix wildcards.  I take the output of the
"ls" command into a "foreach" loop, executing the loop once for each file
that matches the wildcarded expression.

     It has just dawned on me that if the user enters an erroneous argu-
ment, the "ls" command executed on the mixture of regular characters and
wildcards might not find a match.

     The default Unix complaint when this happens isn't bad, but I think it   
would be better if, instead of having Unix complain, my "perl" script could
recognize ahead of time that there is no match for the wildcarded expres-
sion, and make a statement to that extent without ever executing the "ls"
command.

     Does anybody know a way to do that?  Any information would be appreci-   
ated.

                                     ---Kevin Simonson
 -------------------------------------------------------------------------
     Reverence                   To send me mail, remove "_nospam" and
     the eternal.                all the vowels from my login name.


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

Date: Thu, 30 Oct 1997 14:11:23 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Telling Whether a Wildcarded Regular Expression Will Match Any Files
Message-Id: <blpa36.62c.ln@localhost>

Kevin M Simonson (simonsen_nospam@skopen.dseg.ti.com) wrote:

[snip]

:      It has just dawned on me that if the user enters an erroneous argu-
: ment, the "ls" command executed on the mixture of regular characters and
: wildcards might not find a match.

:      The default Unix complaint when this happens isn't bad, but I think it   
: would be better if, instead of having Unix complain, my "perl" script could
: recognize ahead of time that there is no match for the wildcarded expres-
: sion, and make a statement to that extent without ever executing the "ls"
: command.

:      Does anybody know a way to do that?  Any information would be appreci-   
: ated.

   @files = glob($conglomerate_pathname); # see glob() in perlfunc man page
   die "no match found for '$conglomerate_pathname' unless @files > 0"


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Thu, 30 Oct 1997 11:59:17 -0500
From: hobo@alumni.stanford.org (Licensed User)
Subject: Re: Use perl from Visual Basic
Message-Id: <MPG.ec286f198bb5f7d989684@news.ricochet.net>

In article <344f3d56.25072933@news.compuserve.com>, 
ivkovic@compuserve.com says...
> So, I would like to be able to include perl code into VBA code. I
> don't know if/how I can call the PerlIIS.dll from VB and get the
> return values.
> Or, if I shell to perl.exe executing a script, how do I send things
> from VB to <STDIN> of the perl script, and how do I get back in VB
> what perl prints to <STDOUT>?
> 
> Thank you for any help...
> 
> Milivoj
> 
I just figured out how to do this.  In your vb program use the 
kernel32.dll and createprocess to create your perl program.. Then create 
anonymous pipes to pump the data from the perl program to your VB 
program...

Stan


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

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

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