[6891] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 516 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 22 20:07:17 1997

Date: Thu, 22 May 97 17:00:30 -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           Thu, 22 May 1997     Volume: 8 Number: 516

Today's topics:
     Re: "email me when the URL changes" script? (Abigail)
     $ARGV not working? <craig@lucent.com>
     Re: 2-way communication with unix command (Andrew M. Langmead)
     Are there any Perl bussiness accounting applications? (Znanie Bookstore)
     Compiling Perl with MULTIPLICITY (Doug Young)
     Re: File Locking w/ PERL (Abigail)
     Re: help - grep lines between two line patterns <merlyn@stonehenge.com>
     Re: How to use data files? (Bill)
     Just a long shot ... <jlguru@cris.com>
     My keys are numbers... <mrchristopher@inorbit.com>
     Re: My keys are numbers... <eike.grote@theo.phy.uni-bayreuth.de>
     Re: Normal Array to Associative Array (Bob Wilkinson)
     output-> Content-Length: (Kevin M Shortt)
     Re: Page grabber? (Clay Irving)
     Re: parsing one line at a time problem. <eranb@ncc.co.il>
     Re: Patch to Perl 5.004 for case-insensitive patterns ( (John A. Murphy)
     PerlNT/95 gethostbyname <ccu@sbk-ks.de>
     Re: Reading the last line of a file <rmaillet@inigo.us.dg.com>
     Re: Reading the last line of a file (Joel Graber)
     regexp problem (Mr Simon Lee)
     Re: script to parse from lines? (Nathan V. Patwardhan)
     Scripts don't give the output. <ayafall@dartmouth.ccfne.ns.ca>
     Re: SEGV from hash declaration <minaret@sprynet.com>
     Re: Size of simple scalar values (Bob Wilkinson)
     split'\|'; except when preceded by '/' <danboo@ixl.com>
     Re: Stalling Perl Reports.... <psrc@corp.airmedia.com>
     Strange output files <Jack@jack.com>
     Re: The perl way? What is it really? (Abigail)
     Re: Too many instances of perl.exe at once! <petri.backstrom@icl.fi>
     Re: Transformation of string into a variable in Perl? <petri.backstrom@icl.fi>
     yet another perl regex Q (John L. Allen)
     Re: yyyymmdd from localtime? (felix k sheng)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 22 May 1997 22:45:40 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: "email me when the URL changes" script?
Message-Id: <EALtw5.nD@nonexistent.com>

On Thu, 22 May 1997 19:31:54 GMT, Tung-chiang Yang (tcyang@netcom.com) wrote
in comp.lang.perl.misc
<URL: news:tcyangEALKx6.HEr@netcom.com>:
++ Pages with server side include counters will change every time you
++ touch it......  The only way to see if a page changes is checking
++ its modification time, but I am not sure if lynx or telnet 80 can
++ do this.

It's an optional HTTP header, which certainly can be found using telnet.
Unfortunally, a lot of servers don't include a last modified HTTP
header if the page contains a SSI, or is generated by a program.

Followups set.



Abigail


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

Date: Thu, 22 May 1997 17:38:48 -0500
From: "Craig M. Votava" <craig@lucent.com>
Subject: $ARGV not working?
Message-Id: <3384CAF8.41C6@lucent.com>

Folks-

I seem to be confused about how the scalar special variable $ARGV is
supposed to work. In both the blue camel and Perl5 Desktop Reference, it
says:

        $ARGV - The name of the current file when reading from <>

So the following program (if executed with a '*' argument in a directory
that has ascii files) should print out all of the different file names,
one for each line in the file, right? On my system it only prints the
filename of the last file, for every line in every file. Please help!

Thanks

-Craig

	()_()	Craig Votava
	 (_)	Lucent Technologies
		craig@lucent.com

===========================================================
#!/opt/nwstools/bin/perl
#
# Save this as a file called ptest. Then Execute this in a
# directory with multiple ascii files using the command line:
#
#       $ ptest *
#

print "Reading files\n";

foreach $line (<>) {
        print "Current Filename = $ARGV\n";
}

print "\nDone\n";


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

Date: Thu, 22 May 1997 13:27:35 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: 2-way communication with unix command
Message-Id: <EAL41z.5DL@world.std.com>

wpollans@scrap.encore.com (Warren Pollans) writes:

>	It seems I need both:
>		open(FH1, "| crash") and open(FH2, "crash |")
>	with some form of coordination between FH1 and FH2.

There is an entry in the FAQ that may be of interest to you:

  How can I open a pipe both to and from a command?

    The IPC::Open2 module (part of the standard perl distribution) is an
    easy-to-use approach that internally uses pipe(), fork(), and exec()
    to do the job. Make sure you read the deadlock warnings in its
    documentation, though (see the IPC::Open2 manpage).

Unfortunately, it assumes you are using perl5. Two or so years ago,
when everyone was using perl version 4, there was a similar library
called open2.pl in the standard perl distribution.

If buffering is a problem, then you might want to look at
<http://www.perl.com/cgi-bin/cpan_mod?module=Comm.pl> which uses
psuedo terminals instead of direct pipes.

-- 
Andrew Langmead


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

Date: Thu, 22 May 1997 23:15:12 GMT
From: znanie@netcom.com (Znanie Bookstore)
Subject: Are there any Perl bussiness accounting applications?
Message-Id: <znanieEALv9D.Kn9@netcom.com>
Keywords: Accounting Transaction Processing

Are there any business accounting packages written in perl and available on the
net?




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

Date: 22 May 1997 17:46:03 GMT
From: dyoung@chromium.geoworks.com (Doug Young)
Subject: Compiling Perl with MULTIPLICITY
Message-Id: <5m20or$hnh$1@news>

I am trying to compile perl on the following system:

sparc ultra
solaris 2.5
Sun cc version 4.2

Everything seems to work fine normally, but since I am going to be
embedding mulitiple concurrently running PERL interpreters in one
multi-threaded server process, I need -DMULTIPLICITY (according to
perlembed man page)...
When I use -DMULTIPLICITY miniperl compiles, but segfaults on the
line:
--
main(int argc, char **argv, char **env)
{
    int exitstatus;
 
    PERL_SYS_INIT(&argc,&argv);
 
    perl_init_i18nl14n(1);

--> if (!do_undump) {
        my_perl = perl_alloc();
        if (!my_perl)
            exit(1);
        perl_construct( my_perl );
    }
--
I tried dbx, which told me:
--
signal SEGV (no mapping at the fault address) in main \
at line 38 in file "miniperlmain.c"
--
Does anybody have any experience they can share with this?
Is there anyway to imbed multiple concurrent PERL interpreters safely
in one process without MULTIPLICITY?

Any help would be appreciated.
-- 
Doug Young -- dyoung@geoworks.com
	"If you start with a hammer, all of your problems tend to look
	 a lot like nails."
	Phone: 510-814-5893	Fax: 510-814-4250


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

Date: Thu, 22 May 1997 20:18:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: File Locking w/ PERL
Message-Id: <EALn3C.8wz@nonexistent.com>

On Thu, 22 May 1997 14:02:41 +0100, Bob Wilkinson (b.wilkinson@pindar.co.uk)
wrote in comp.lang.perl.misc
<URL: news:b.wilkinson-2205971402410001@ip57-york.pindar.co.uk>:
++ 
++       Read pp.167 of the O'Reilly perl book, and you'll see
++ 
++ 1. The file must be locked before you open it.

Uhm, how are you going to do this? My O'Reilly book has an example on
p 166/167 that clearly locks the file after opening it.

++ 2. The file must be unlocked after you close it.

close () unlocks.



Abigail


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

Date: 22 May 1997 07:53:15 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: help - grep lines between two line patterns
Message-Id: <8cn2pnftic.fsf@gadget.cscaper.com>

>>>>> "EtB" == Eli the Bearded <usenet-tag@qz.little-neck.ny.us> writes:

EtB> 		[\x00-\xFF]*?	# Smallest possible string of any char

Or you can write:

	[\s\S]*?

for that.  I often do.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 467 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 22 May 1997 22:24:34 GMT
From: bill@sover.net.no.junkmail (Bill)
Subject: Re: How to use data files?
Message-Id: <slrn5o9ht2.s2e.bill@granite.sover.net>

Cristian  Satnic wrote:
>I have a file where on each line there is a string and a number such as
>
>Furniture 23
>Bedroom 45
>
>and so on.
>
>I want to read this into an array and change the numbers based on
>comparisons on the strings. (the strings will be the keywords for
>comparisons and when I get a match I work with the number - an associative
>array).  How can I do this (read the file into the associative array)?
>
>Thanks

Try something like:

  # (Untested code)

  open(FILE, "datafile.txt") or die "Couldn't open datafile.txt: $!\n";
  # Store data in an associative array
  while (<FILE>) {
      chomp;  # Remove trailing newline
      ($name, $number) = split(/\s+);  # Split on one or more whitespace chars
      $data{$name} = $number;  # Store info in assoc. array by name
  }
  close(FILE);
  # (Process things by name or whatever you had planned)

						Bill
-- 
Sending me unsolicited email through mass emailing about a product or
service your company sells ensures that I will never buy or recommend your
product or service.


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

Date: Thu, 22 May 1997 17:15:03 -0600
From: "Jerry L. Gubka" <jlguru@cris.com>
Subject: Just a long shot ...
Message-Id: <3384D377.529@cris.com>

To all:

I've developed a Perl script that recursively scans through a directory,
and all subdirectories, to find file names/sizes/4dos-4nt descriptions/
PKZIP comments. It then writes a report of all files/comments found. The
report is to be included w/ a project summary to a client. In the final
lines of the report, I'm trying to sum all the file sizes and report
total bytes in the client's subdirectory. The problem I'm having is that
the total byte count is off (compared to a DOS "dir" listing),
apparently because the report file is part of the directory and it is
still open and being written to at time file sizes are acquired.

My question ... is there something obvious I'm missing, or can someone
suggest a slick way that the summary byte count in the report can be
made to match the final byte count in the directory? I don't really
think so, but I've seen some "deep magic" presented here in the past and
this post is in hope some more will become evident.

BTW - this is with Perl 5.003 w/ WinNT-Win95. I would post the script,
but it's some 300+ lines long. If you are interested, I'll e-mail it
seperately.

Live long, and prosper
Jerry L. Gubka


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

Date: Thu, 22 May 1997 22:26:46 +0900
From: christopher <mrchristopher@inorbit.com>
Subject: My keys are numbers...
Message-Id: <33844996.3AA6@inorbit.com>

Hello again helpful people... 

%um=(
100	=>	[0,1000],
20	=>	[1000,2000],
30	=>	[1500,3000]);

@bands=sort keys %um;
foreach $band(@bands){print "$band :"}

says:

100 : 20 : 30

I want it to say  20 : 30 : 100 (suprise suprise).  But so far I can't
no matter how many times I read the FAQ etc etc. Could someone be so
kind as to enlighten me please ?

Thanks!

Christopher
Tokyo, May97

http://www.wonderlandinorbit.com


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

Date: Thu, 22 May 1997 16:32:30 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: My keys are numbers...
Message-Id: <338458FE.2781@theo.phy.uni-bayreuth.de>

Hi,

christopher wrote:
> 
> Hello again helpful people...
> 
> %um=(
> 100     =>      [0,1000],
> 20      =>      [1000,2000],
> 30      =>      [1500,3000]);
> 
> @bands=sort keys %um;
> foreach $band(@bands){print "$band :"}
> 
> says:
> 
> 100 : 20 : 30
> 
> I want it to say  20 : 30 : 100 (suprise suprise).  But so far I can't
> no matter how many times I read the FAQ etc etc.

 ... ? And what about the man pages? Didn't you take a look at
'perlfunc', section 'sort'? It says:

      ...
    # sort numerically ascending
    @articles = sort {$a <=> $b} @files;
      ...

So, just include "{$a <=> $b}" after your 'sort' command (the default
sorting method is "{$a cmp $b}" which sorts by ASCII code).

If this isn't enough for you, go to

   http://www.perl.com/all_about/sort.html


Bye, Eike
--
======================================================================
 Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
 e-mail -> eike.grote@theo.phy.uni-bayreuth.de
 WWW    -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html 
           http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================


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

Date: Thu, 22 May 1997 13:50:50 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Normal Array to Associative Array
Message-Id: <b.wilkinson-2205971350500001@ip57-york.pindar.co.uk>

In article <5lvetb$2k3@news.tamu.edu>, ratboy@cyberenet.net (Michael
Caver) wrote:

> I'm trying to move the text content of a normal array to an associative array
> without a lot of "foreach" statements. I saw some posts here that said use:
> 
>    $assoc{'array'} = \@array;
> 
> But when I do this I get:
> 
>    ARRAY(0x80b88c4)
> 
> Any idea what that means or what I might be doing wrong?
> 
> 
> -Michael

Hello,

      What you've done is assign a reference to a list to an element of an 
associative array, this is what ARRAY(0x80b88c4) is.

      Your question is ambiguous to me. How do you want to move the normal
array to the associative array? As keys into the array (then what are the
corresponding values?), or as values (what are the corresponding keys?).

      I think that an associative array is a list (like a normal array), which
has alternating keys and values. However, in order to answer your question I'd
need to know about the half of the information you've not supplied.

Bob

-- 
I have become death, destroyer of the worlds.


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

Date: 22 May 1997 18:55:03 GMT
From: shortt@acsu.buffalo.edu (Kevin M Shortt)
Subject: output-> Content-Length:
Message-Id: <5m24q7$cdg@prometheus.acsu.buffalo.edu>

 ..my apologies for mis-posting to perl.modules...that was in err.



I am parsing a file, grabbing a line out of it and mailing it to myself.
the mail msg happens to contain 'Content-Length: 78' in every msg. the number
is of course variant to the actual length.
 
I've used this same procedure/syntax before...in fact i've something in
place that does it once a day. HOWever, it doesn't contain the 'Content-Length:
78' stuff....I want to be able to do this with out it. This is really just
a peeve...not of major importance. But, it would be nice to know why this is
happening.  I searched the FAQ's and dejanews...I'm at a loss.
 
any help would be appreciated.
thanks
 
-kevin
 
my code:
-------------------------------------------------------------
$user = 'whoever@foo.com';
$myfile = 'anyfile';
$date =`date`;
($DoW, $month, $day, $time, $zone, $year)= split(/ /,$date);
$date ="$month"." $day";
 
 
open(MAIL, "| /usr/ucb/mail -s 'SUBJ HERE ' $user");
open(FILE, $myfile);
$ver = $];
print MAIL "Using Perl $ver\n";
 
while(<FILE>){
 
    ($var1, $var2, $var3, $var4) = split (/;/,$_);
    if($var1 eq $date){
        print MAIL "\nBlah Blah\n";
    }
}
close(FILE);
close(MAIL);
exit;



my output:
-------------------------------------------------------------
 
Content-Length: 96
 
Using Perl 5.002
 
Blah Blah
 



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

Date: 22 May 1997 09:08:26 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: Page grabber?
Message-Id: <5m1gga$fb0@panix.com>

In <5lv79g$f03@jazz.cs.Virginia.EDU> bah6f@cs.virginia.edu (Paco Hope) writes:

>Has anyone written a simple program, like churl, which will
>download the content of all the things pointed to on a
>web page.

>Churl already goes out and verifies that all the links on a page are
>good.  I'd just like to slightly modify it to follow those links one
>level and save what it found to local files.

>This sort of thing is easy enough with the LWP tools, but I'm hoping
>to find it rather than write it.

Take a peek at: 

	Perl Reference / Web Administration
	http://www.panix.com/~clay/perl/query.cgi?webadmin+index

-- 
Clay Irving                                        See the happy moron,
clay@panix.com                                     He doesn't give a damn,
http://www.panix.com/~clay                         I wish I were a moron,
                                                   My God! Perhaps I am!


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

Date: 22 May 1997 13:15:05 GMT
From: "Eran Roy Barak" <eranb@ncc.co.il>
Subject: Re: parsing one line at a time problem.
Message-Id: <01bc66b1$cdc4c2c0$15ff18ac@eranb.ncc.co.il>



Scott <Scott@wwide.com> wrote in article <3383BB6A.4D21@wwide.com>...
> Hi,
> 
>  I sent a message ealier and it was incorrect.. This is
> my problem:
> 
> I have a text file that is space delimited.. I know, i know, 
> their is not suppose to be anything space delimited, but this
> file is.. my system creates it every day and I can not change that
> anyway, here is what it looks like:
> 
Reading a file one line at a time is easily done with perl's open
statement. Just define \n as your delimiter when reading. There are many
examples in everywhere.

Assuming $line_of_text variable holds a single line of text, use perl's
split function to parse the text (note that it accepts regular expressions
for its delimiter argument).
The statment:
	@words = split(/ +/, $line_of_text);
would parse all the fields into the 'words' array, which could then be
easily accessed via words[0], words[1], etc.
The "/ /" (without quotes!) regexp should serach for a single space. The "/
+/" regexp would mean one or more consequtive spaces (check perl's regular
expression documentation to be sure).
Having that regexp as a delimiter does the job.


Eran Roy Barak		<eranb@ncc.co.il>



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

Date: 22 May 1997 13:25:34 GMT
From: jam@philabs.research.philips.com (John A. Murphy)
Subject: Re: Patch to Perl 5.004 for case-insensitive patterns (REFCASE1)
Message-Id: <5m1hge$oth$1@philabs.research.philips.com>


In article <5lvl48$1r0$1@philabs.research.philips.com>, jam@philabs.research.philips.com (John A. Murphy) writes:
|> 
|> The patch was bombing for me too.  I noticed that this looks like it patched
|> only one file, but the patch I got is supposed to patch 3 different files.

Ack, to answer my own question...

I recently mucked my path to have /bin before gnu/bin.  This left me
with calling the Solaris /bin/patch instead of the one true patch program.
/usr/local/gnu/bin/patch worked fine and patched all 4 files.  To answer
the original poster, go get the patch source from a gnu site, should be
version 2.1.

Murf




-- 
John A. Murphy (better known as Erin's dad)  jam@philabs.research.philips.com
345 Scarborough Road          One one-trillionith of a surprise: picoboo
Briarcliff Manor, NY 10510    millihellen: The beauty needed to launch 1 ship
(914)945-6216 ** My views and opinions do not reflect those of my employer **


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

Date: 22 May 1997 12:11:33 GMT
From: "Carl K. Cunningham" <ccu@sbk-ks.de>
Subject: PerlNT/95 gethostbyname
Message-Id: <01bc66b2$a5329a20$490e10c1@opal.sbk-ks.de>

I'm using Perl95/NT version 5.003_07 and I've noticed that "gethostbyname"
lookups are painfully slow. Any particular reason why?
-- 
Carl K. Cunningham
SBK Software + Systeme GmbH
Hollaendische Strasse 141
34127 Kassel
Germany
Tel: (+49) 561 9899 754
Fax: (+49) 561 851 61



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

Date: Thu, 22 May 1997 09:58:42 -0400
From: Bob Maillet <rmaillet@inigo.us.dg.com>
Subject: Re: Reading the last line of a file
Message-Id: <33845112.90FAB2F0@inigo.us.dg.com>

 I also must add there are always 30 lines in the file that is being
read.



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

Date: 22 May 1997 20:26:41 GMT
From: jgraber@daldd.sc.ti.com (Joel Graber)
Subject: Re: Reading the last line of a file
Message-Id: <JGRABER.97May22152641@sun_7407>


In article <5m22m7$9su$1@marina.cinenet.net> cberry@cinenet.net 
(Craig Berry) writes:

> As near as I can tell from reading the 'perldata' doc, $list[$#list] and 
> $list[-1] are entirely equivalent expressions.  

I didn't see that in  man perldata, and it isn't (entirely) true.
 perl -e '$[=-4; @l=qw(a b c d e f g h); print " $l[$#l] , $l[-1] : @l\n";'
 h , d : a b c d e f g h


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

Date: 21 May 1997 16:20:18 GMT
From: silee@news.hk.super.net (Mr Simon Lee)
Subject: regexp problem
Message-Id: <5lv7c2$2ui$1@tst.hk.super.net>

All,

    I recently need to match the df output of the SunOS 4.1.x and
    SunOS 5.x. Their outputs are:

        SunOS 4.1.3:

            /dev/sda0           31199   13477    16111     46%   /

        SunOS 5.x:

            /dev/dsk/c0t0d0s0   31199   13477    16111     46%   /


    so I rsh to each machine, and get their df outputs, and do:
    (match all the chars and digits in the line, optionally
     match /\w+ e.g. /c0t0d0s0)

        if (m|(/dev/\w+(/\w+)?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(.*)|) {
                print "$1,$2,$3,$4,$5,$6\n";
        }

    I expect the outputs would be either:

        /dev/sda0,31199,13477,16111,46,/

    or

        /dev/dsk/c0t0d0s0,31199,13477,16111,46,/


    but I acutally gets:

        /dev/sda0,,13477,16111,46,/

    and

        /dev/dsk/c0t0d0s0,/c0t0d0s0,13477,16111,46,/

    Does anyone know the correct answer ?

Thanks,
Simon


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

Date: 22 May 1997 13:27:27 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: script to parse from lines?
Message-Id: <5m1hjv$46k@fridge-nf0.shore.net>

Matthew Darwin (matthew@spam.davin.ottawa.on.ca) wrote:
: Is there a script out there to parse "From:" lines?

Get the Mail modules from a CPAN near you!

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Thu, 22 May 1997 11:41:59 -0700
From: Aya Fall <ayafall@dartmouth.ccfne.ns.ca>
Subject: Scripts don't give the output.
Message-Id: <33849377.3527@dartmouth.ccfne.ns.ca>

Hi there:
I am a student, actually self-training in Perl, but I'm having 
some difficult times and I would welcome any hints from you, please.
Here are my problems:

1 - I'created CGI-Scripts,for what should a quite simple application,
with Perl,
    but they don't produce the expected output (HTML pages).
2. When I try to open the URL location, I have the scripts in text
format, rather than
   having Web pages as front-end.
3. What I want to do is this:
     - present a form to be filled by the student, who then clicks on
Submit
     - the data should be referred to a script, for parsing and then
open a second
       form. Once this latter is filled and posted, the information is
stored in a
       file. I can't get this working.

I desperately need help as I have to submit this project before the 
end of May. So, I would appreciate your help.

Thanks,

Aya.


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

Date: 22 May 1997 14:08:20 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: SEGV from hash declaration
Message-Id: <01bc66b9$5bb80220$d9c5aec7@cactus>

It's either a bug in Perl or you have a funky Perl binary.  Perl should
never dump core.  The best thing to do is create the smallest script that
will cause Perl to crash and post it to the "perl.porters-gw" newsgroup. 
They may or may not respond and it may or may not get fixed if it is a bug.


Geoff Mottram
minaret@sprynet.com


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

Date: Thu, 22 May 1997 13:55:18 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Size of simple scalar values
Message-Id: <b.wilkinson-2205971355180001@ip57-york.pindar.co.uk>

In article <33833F96.608B@lanl.gov>, "Douglas A. Smith" <douglas@lanl.gov>
wrote:

> Hello-
> 
> I've gone through various books, and I can't find a answer to this
> problem:
> 
> I have a script which adds large sets of data and compares small
> differences in these sets.  The problem comes when the sums start
> to get larger than 2.14 billion.  Everything works for sums less 
> than this number, but when they get larger than 2.14 billion I get
> negative values, and then just a -1.
> 
> Is there a way to get perl to force the use of more bytes used in
> integer scalars?  I don't want to force the use of floating point
> numbers since I need the absolute accuracy of the integer sum.
> 
> Please Help-
> 
> Douglas Smith
> douglas@lanl.gov

Hello,

      Look on CPAN for a module called Math::BigInt.pm.

Bob

-- 
I have become death, destroyer of the worlds.


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

Date: Thu, 22 May 1997 15:03:08 -0400
From: Dan Boorstein <danboo@ixl.com>
Subject: split'\|'; except when preceded by '/'
Message-Id: <3384986C.4A19A768@ixl.com>

Hello All,

Here is the problem.

  A string with: no linefeeds
                 fields separated by |
                 nested |'s are escaped with \ (i.e., \|)

I want to split this string on unescaped |'s, removing
the \'s preceding the escaped |'s. I thought this would
be a 2 line split-regex block, but has turned into
something much less elegant which I pieced together
from various FAQ's and Dejanews articles. Behold:

$_ = '\||split|me|\|<no split|1\|=\|1|3|' . 'EOQ';
@temp = split'\|';
for ($i = 0; $i <= $#temp; $i++){
  $field = $temp[$i];
  while ($field =~ s/\\$/|/) { $field .= $temp[++$i]; }
  push(@fields, $field);
}
$fields[$#fields] =~ s,EOQ$,,;

for(@fields) { print $_, "\n"; }

After execution @fields contains (as expected):
('|','split','me','|<no split','1|=|1','3','')

It does everything I wanted it to do, but not as cleanly as I'd
hoped. Any ideas on how to clean up this process (not necessarily
my coding style)?

Thanks,

Dan Boorstein
danboo@ixl.com


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

Date: Thu, 22 May 1997 10:24:46 -0400
From: Paul S R Chisholm <psrc@corp.airmedia.com>
To: Daniel J Pearce <djp@sai-baba.demon.co.uk>, Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Stalling Perl Reports....
Message-Id: <3384572E.4EA2@corp.airmedia.com>

Tom Phoenix wrote:
> ... it's not hard to open a pipe to a pager
> yourself (respecting the user's choice of $PAGER, of course). Just print
> to that, and it'll take care of everything.

Except that you need to make sure you catch SIGPIPE, a signal you'll get
if the user quits out of the pager early. (Ignoring SIGPIPE should work,
too, but there've been some postings saying otherwise.)  --PSRC


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

Date: Thu, 22 May 1997 15:46:29 +0300
From: Jack <Jack@jack.com>
Subject: Strange output files
Message-Id: <33844025.FAF@jack.com>

Hi!

I have a script that proceeses a form  and puts the info into a file
called comments.htm in c:\Program Files\perl5\bin -directory. It creates
the file OK, but at the same time it writes an extra file in the same
directory. 
The name of the file is always - and a number, for instance -430. When I
read this file with Notepad, it contains the same data that in
comments.htm.

Can anyone help?


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

Date: Thu, 22 May 1997 22:52:17 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: The perl way? What is it really?
Message-Id: <EALu75.18I@nonexistent.com>

On 22 May 1997 21:02:20 +0200, Niklas Paulsson (niklas@grok.adb.gu.se) wrote
in comp.lang.perl.misc
<URL: news:5m257s$mbi@grok.adb.gu.se>:
++ 
++ I remember some programing course at the university when my lecturer
++ said something like "break and countinue statements are only to use
++ for those who are incapable of writing down a correct iteration 
++ condition", somehow I get the impression that perl-people aren't to
++ picky about those things.... 

In a sense this is true. A break/continue/next/last is nothing more
than a goto, and we'll all know what Dijkstra said: Goto considered
harmful.

It's a pain in the ass to proof the correctness of your program if
it contains goto's. [*]

++ But people keep refering to "the perl way of doing things", and I
++ really wonder what is "the perl way of doing things"...

The Perl way is: There is more than one way to do it.



Abigail

[*] Anyone out there teaching program correctness and using Perl
    programs as examples?


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

Date: Thu, 22 May 1997 14:43:27 +0200
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Too many instances of perl.exe at once!
Message-Id: <33843F6F.3A61@icl.fi>

TRG Custom Graphics wrote:
> 
> I need some advice on what to do about this. I am running a multi forum
> chat site, and it's calling to the perl.exe everytime!.. is there any
> ISAPI type solution?. Something to where I can only run one instance and
> not have it keep reloading?. This would solve about 80% of my problems
> with the hundreds of thousands of hits I get daily!.. Thanks.,.
> Tim..
> customdesign@nstate.net

If "ISAPI type solution" and "perl.exe" is an indication that you're 
on a Windows NT server, then try using PerlIIS. See 

    http://www.activeware.com

for more.

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: Thu, 22 May 1997 14:50:07 +0200
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Transformation of string into a variable in Perl?
Message-Id: <338440FF.940@icl.fi>

Hayo Hase wrote:
> 
> I would like to find a way in Perl, how I can generate variables out of
> string contents.
[snip]

This is quite explicitely documented, methinks; see your Perl 
documentation (look for "Symbolic references" in perlfunc, in 
specific). 

Small excerpt from the section in question:

    $name = "foo";
    $$name = 1;                 # Sets $foo

regards,
 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: 22 May 1997 11:05:36 -0400
From: allen@gateway.grumman.com (John L. Allen)
Subject: yet another perl regex Q
Message-Id: <5m1nc0$jee@gateway.grumman.com>

I know this is probably explained in the Hip Owls book somewhere, but
I don't have it handy, so please suffer my ignorance.  Why doesn't
either of the following replace the *last* three blanks in $_ with 'bar'?

	perl -e '$_="foo      xxx"; s/ {3}(?=.*)$/bar/; print'

	perl -e '$_="foo      xxx"; s/ {3}(?=.*?)$/bar/; print'

and _don't_ tell me it's because of the .* because .+ doesn't work either.

I expected backtracking to occur from the end of $_ until three blanks
are found.  Why doesn't it work?

I was trying to use one of the above as a simpler (hah!) alternative to

	perl -e '$_="foo      xxx"; s/(.*)( {3})(.*?)$/\1bar\3/; print'

which does what I want but screams UGLY.  The immediate zero-width analogue
to this does't do any substitution either

	perl -e '$_="foo      xxx"; s/(?=.*) {3}(?=.*?)$/bar/; print'

[ this was all with perl5.004, if anyone cares ]

John.


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

Date: 22 May 1997 14:51:47 GMT
From: felix@chance.em.nytimes.com (felix k sheng)
Subject: Re: yyyymmdd from localtime?
Message-Id: <slrn5o8nmu.bfc.felix@chance.em.nytimes.com>

On Wed, 21 May 1997 16:32:38 -0400, Vincent Kargatis
<kargatis@jackaldog.gsfc.nasa.gov> wrote:
>I want to get a YYYYMMDD from localtime.  Is there a simpler way than
>this (I'm just curious from an educational standpoint):
>
>($day,$month,$year)=(localtime)[3,4,5];
>$month++;
>$month="0"."$month" if length($month)==1;
>$date=($year+1900).$month.$day;
>
>Is there a one-line version?

while not as nice as gisle's version - and not as generic - this will
work in perl5.003:

sprintf( "19%02d%02d%02d", map { $_+=($x%=2);$x++;$_ } (localtime)[5,4,3] );

i feel like i should be able to do the whole thing in at least one
last statement, but i can't seem to put my finger on it. that trailing
$_ is pretty weak.  if anyone can show me how i'd really enjoy seeing it.

'lx


--- felix sheng                                       pager     800 979 2171
 programmer                                           tel       212 597 8069
 the new york times electronic media company          e    felix@nytimes.com


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

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

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