[11648] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5248 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 29 05:03:16 1999

Date: Mon, 29 Mar 99 02:00:20 -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           Mon, 29 Mar 1999     Volume: 8 Number: 5248

Today's topics:
    Re: Adding an $ENV variable? (Tad McClellan)
    Re: anything like xemacs for win32? <pboldra@spam_to_hell.dynamite.com.au>
    Re: Calculating the current time in London or GMT+x <sb@sdm.de>
    Re: code to search for URLs? <john@egovision.co.uk>
    Re: drawing pixels in Perl? - HSB to RGB <pboldra@spam_to_hell.dynamite.com.au>
    Re: Easy ?... why doesn't this script run on NT? <greenej@my-dejanews.com>
    Re: embeded Perl on Win32 <Piotr.Martyniuk@softax.com.pl>
        Extracting data from HTML source brackett@pobox.com
    Re: Extracting data from HTML source (Larry Rosler)
    Re: Help with split (Abigail)
    Re: Initializing an array with STDIN (newbie) <hove@ido.phys.ntnu.no>
    Re: Language Netiquette (Was: Re: Counter Digits) (Jonathan Stowe)
        Need perl compiler ahoben@globeaccess.net
        qe:operation on binary files <nirl@zoran.co.il>
    Re: RE to match one line of Larry's quote (Larry Rosler)
    Re: RE to match one line of Larry's quote (Sam Holden)
    Re: SIGPIPE and SIGCHLD Signals on win32. Please tell m <ppa@itmasters.com>
    Re: SIGPIPE and SIGCHLD Signals on win32. Please tell m (Ilya Zakharevich)
        sorting associative array by values <hjmoon@netsgo.com>
    Re: sorting associative array by values (Larry Rosler)
    Re: Spider (Jonathan Stowe)
    Re: Split with + , but no %2B (David H. Adler)
    Re: The ONLY reg exp question I will EVER post again! <rick.thomas@ibm.net>
    Re: The ONLY reg exp question I will EVER post again! <rick.thomas@ibm.net>
    Re: Values of 'true' and 'false'? <Philip.Newton@datenrevision.de>
    Re: Very large float arrays and size problem <loulou@ltt.ntua.gr>
        Why am I stuck? <ophir@saifun.com>
    Re: Why am I stuck? (Steve Grantz)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Sun, 28 Mar 1999 17:54:25 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Adding an $ENV variable?
Message-Id: <1vbmd7.ta5.ln@magna.metronet.com>

Mike Watkins (mwatkins@promotion4free.com) wrote:

: I was just wondering, is there anyway to add a variable into the hash  %ENV?


   Sure.

   You just assign to it like any other hash.


: What I want to do is what the .htaccess Authentication does, when it adds a
: $ENV{'REMOTE_USER'} variable to each person who logs in.

: I need the variable to "stick" though, after the script has finished running
: its process.  


   That is a whole different question.

   A Question that has been Asked Frequently before in fact.

   Perl FAQ, part 8:

      "I {changed directory, modified my environment} in a perl script.  
       How come the change disappeared when I exited the script?  
       How do I get my changes to be visible?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 29 Mar 1999 17:54:13 +1000
From: paulboldra <pboldra@spam_to_hell.dynamite.com.au>
Subject: Re: anything like xemacs for win32?
Message-Id: <36FF31A5.D22BC853@spam_to_hell.dynamite.com.au>

My recommendation is ultraedit32 ( http://www.ultraedit.com ) it colour
codes perl, html, VB, C etc... It has a very untuitive win32 interface,
with regexp find replace capabilities.  Even has a ftp client built in,
so you can edit remote unix scripts almost transparently.  Love it.

"Steven T. Hatton" wrote:

> I have found Xemacs is really good for editing perl code on a linux
> box.  I especially like the color syntax highlighting.  Is there
> anything that runs under win32 that will give me color syntax
> highlighting?  I see that a port to win32 is underway for xemacs.  It
> doesn't look like it's there yet.  There is a  port of emacs, but I
> don't see a way to get the color syntax highlighting with that.
>
> TIA,
>
> Steve
>
> --
> http://www.winehq.com   | I think.
> http://www.suse.com     | I think I am.
> http://www.kde.org      | Therefore I am.
> http://samba.anu.edu.au | I think? - Moody Blues

--
Paulboldra

Web Developer
OzEmail Online Services

02 9433 2469
paulboldra@int.ozemail.com.au




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

Date: 29 Mar 1999 09:37:27 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: Calculating the current time in London or GMT+x
Message-Id: <7dnhkn$i92$1@solti3.sdm.de>

In article <MPG.116558e37c7888f49897d4@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:

> In article <7dfmfp$480$1@solti3.sdm.de> on 26 Mar 1999 10:11:05 GMT, 
> Steffen Beyer <sb@sdm.de > says...

> > AFAIK, DST begins and ends also in the middle of a week in the U.S.
> > 
> > In Europe, however, switching always occurs on a weekend, in the night
> > from saturday to sunday, at 2 o'clock (respectively, 3) in the morning.

> AFAIK (and I *do* know, because I live there), DST in North America 
> begins and ends on Sunday at 2 AM, becoming 3 AM (spring) or 1 AM (fall) 
> respectively.  This year it is 4 April and 31 October.

Then matters really *ARE* different.

This year, DST started yesterday (Sunday 28-Mar-1999) at 2 am, which simply
became 3 am.

On the switching back, however (on Sunday 31-Oct-1999), the clock will be
set back to 2 am at 3 am.

So the day of the start of the DST and the exact procedure of how the
switching back is done differ.

Sincerely,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/download/    (Free Perl and C Software
    http://www.perl.com/CPAN/authors/id/STBEY/         for Download)
    New: Build'n'Play 2.1.0 (all-purpose Unix batch installation tool)
    http://www.oreilly.de/catalog/perlmodger/bnp.html


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

Date: Mon, 29 Mar 1999 09:48:40 +0100
From: "Johnnie ego" <john@egovision.co.uk>
Subject: Re: code to search for URLs?
Message-Id: <7dnemh$7hb$1@starburst.uk.insnet.net>

There is a whois script in Perl at:

http://www.cgi-resources.com/

Which may suit your needs.

John

John Lyons
-----------------------------------
john@egovision.co.uk
*Web reference centre & tutorials:
http://www.egovision.com
*egovision professional Web design:
http://www.egovision.co.uk
-----------------------------------
Kevin Smith wrote in message <36FEDE75.C9FAFAEC@ntexpert.demon.co.uk>...
> Hi,
>I would like to know if there is/are programs
>available that can be incorporated in a web
>page (or CGI script) and that can look up various URLs
>from a users input.
>E.g. A user types in
>"xyz" and the web page then lists all
>domain names that it can contact (without loading the
>page)
>like xyz.com, xyz.net, xyz.co.uk.........
>and so on.
>
>Alternatively, which language do you think
>would be the easiest for writing a program
>to do this? Would javascript do it?
>
>Alternatively, do you know of any websites
>where I could go and look for the appropriate
>code?
>
>Regards,
>Kevin Smith




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

Date: Mon, 29 Mar 1999 16:59:27 +1000
From: paulboldra <pboldra@spam_to_hell.dynamite.com.au>
Subject: Re: drawing pixels in Perl? - HSB to RGB
Message-Id: <36FF24CF.195BF390@spam_to_hell.dynamite.com.au>

Does anyone have any ideas about the second part of Peter's question?
An algorithm or module for converting the common HSB defined colours to
RGB & vice versa?

I suspect I could work it out if I could remember enough geometry, since
it effectively involves converting coordinates on a cylinder (HSB) to a
cube (RGB)...

Peter Bismuti wrote:

> I'd like to be able to draw images at a very low level, i.e.
> I want to be able to draw individual pixels in the screen.
> What is the best module to do this with??
>
> Also, I know nothing about color representation, I know you use
> a 6 digit hex number, but lets say you have a frequency and
> an intensity, how do you then translate that into hex and back
> again??
>
> Thanks!!

--
Paulboldra

Web Developer
OzEmail Online Services

02 9433 2469
paulboldra@int.ozemail.com.au




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

Date: Mon, 29 Mar 1999 06:59:46 GMT
From: JAG <greenej@my-dejanews.com>
Subject: Re: Easy ?... why doesn't this script run on NT?
Message-Id: <7dn8cv$gtf$1@nnrp1.dejanews.com>

In article <36fc47a7.2703237@news.earthlink.net>,
  rogdh@iname.com wrote:
> I type this in on my command line...
> perl -e 'print "hello, world!";'
>
> The error message I get is...
> Can't find string terminator "'" anywhere before EOF at -e line 1.
>
> It works at work .. .(SGI unix)
> However @ home on my NT it doesn't.  I'm using ActivePerl that I just
> DLd.
>

Easy! Windoze NT's command interpreter doesn't understand single quotes (or
much anything else, for that matter). You have to use

perl -e "print qq/hello, world\n/;"

to get the same results on NT. As an alternative, you can download the Cygnus
Solutions bash interpreter for Windows NT, and use a real shell instead of
CMD.EXE.

# James Greene - Informatics Consulting - D-79539 Loerrach, Germany
# Internet: www.gucc.org/greene/consult - greene@gucc.org
# PGP Fingerprint: CA88 9BE2 92B3 3162 DF6B  7080 2F9E A97E F25C 5972

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 29 Mar 1999 09:56:44 GMT
From: "Piotrek" <Piotr.Martyniuk@softax.com.pl>
Subject: Re: embeded Perl on Win32
Message-Id: <7dnib8$tal$1@euler.softax.com.pl>

Hello
This is the end of my problem. I've managed to compile this code:

#include <math.h>
extern "C" {
#include <EXTERN.h>
#include <perl.h>
};

// Perl-Interpreter starts
here ---------------------------------------------
static PerlInterpreter *my_perl;

main (int argc, char **argv, char **env)
{
   char *embedding[] = { "", "-e", "0" };

   my_perl = perl_alloc();
   perl_construct( my_perl );

   perl_parse(my_perl, NULL, 3, embedding, NULL);
   perl_run(my_perl);

   /** Treat $a as an integer **/
   perl_eval_pv("$a = 3; $a **= 2", TRUE);
   printf("a = %d\n", SvIV(perl_get_sv("a", FALSE)));

   /** Treat $a as a float **/
   perl_eval_pv("$a = 3.14; $a **= 2", TRUE);
   printf("a = %f\n", SvNV(perl_get_sv("a", FALSE)));

   /** Treat $a as a string **/
   perl_eval_pv("$a = 'rekcaH lreP rehtonA tsuJ'; $a = reverse($a);", TRUE);
   printf("a = %s\n", SvPV(perl_get_sv("a", FALSE), PL_na));

   perl_destruct(my_perl);
   perl_free(my_perl);
   return 0;
}

Note:
What helped?
1. Declare #include <EXTERN.h> and #include <perl.h> as extern "C"
2. #include <math.h> before  #include <EXTERN.h> and #include <perl.h>

Why:
Problem was concerning only Visual C++ 6.0.
Visual C++ 6.0 when includes <math.h> makes one of the functions declared as
template (when defined
cplusplus). When <math.h> was being included in <perl.h> it was declared as
extern "C", and in this
case template could not be declared - it was a complile error.
When #include <EXTERN.h> and #include <perl.h> were not declared as extern
"C" the PL_na symbol
was not fuond (it was linker error).

So thanks

Bye
Piotrek









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

Date: Mon, 29 Mar 1999 08:01:10 GMT
From: brackett@pobox.com
Subject: Extracting data from HTML source
Message-Id: <7dnc04$jl9$1@nnrp1.dejanews.com>

Apologies in advance because I know I should be able to do this, but I can't
for the life of me get it to work. If I have the following bit of HTML source
code, how do I extract the number XX.X to a variable:

Float</td><td width="12%" align=right><tt>XX.X<small>

Thanks much.

oB Pity: Here is what I've been trying ...

$number = m/Float<\/td><td width="12%" align=right><tt>(.*?)<s/;

P.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 29 Mar 1999 01:00:14 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Extracting data from HTML source
Message-Id: <MPG.1168e0f436ab13699897e7@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7dnc04$jl9$1@nnrp1.dejanews.com> on Mon, 29 Mar 1999 
08:01:10 GMT, brackett@pobox.com <brackett@pobox.com >says...
 ...
> oB Pity: Here is what I've been trying ...
> 
> $number = m/Float<\/td><td width="12%" align=right><tt>(.*?)<s/;
          =~

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com


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

Date: 29 Mar 1999 06:01:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help with split
Message-Id: <7dn4vt$di2$6@client2.news.psi.net>

nf0 (nf0@10500bc.org) wrote on MMXXXVI September MCMXCIII in
<URL:news:36fef2d1.7640066@news.hex.net>:
~~ I'm trying to split a line like this:
~~ article.php3?file=issues/199903/something
~~ I want to split on the /'s but I can't seem to 
~~ get the syntax correct could some one help?


split m{/} => "article.php3?file=issues/199903/something";



Abigail
-- 
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: 29 Mar 1999 11:31:22 +0200
From: Joakim Hove <hove@ido.phys.ntnu.no>
Subject: Re: Initializing an array with STDIN (newbie)
Message-Id: <k0noglclk0l.fsf@ido.phys.ntnu.no>

Sender <fairfiel@dundee.net> writes:


> OK.....here's two ways I tried:
> 
> 
> #!/usr/bin/perl -w
> 
> open (INFILE, "/home/bb/docs/list/book");

Check that your open statement did indeed succed :
open(INFILE,"...") || die("Could not open ... $! \n");

 
> @order = INFILE;

@order = <INFILE>;
 
> split(/^$/, INFILE);

INFILE is a filehandle and can not be split. What you want to split is
the @order array. However I doubt you really want to do that. Now you
have an array @order where $order[0] is the first line, $order[1] is
the second line etc., wasn't that what you wanted?

> print "\n", $order[442];
> 
> close (INFILE);


An alternative way of accomplishing the same as above is :

while (defined($line = <INFILE>)) { # If your Perl -v > 5.005(?) you can
                                    # skip defined(..). 
   chomp $line;
   push @order, $line;              # Insert $line at the end of @order.
}
close(INFILE);

HTH - Joakim



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

Date: Mon, 29 Mar 1999 08:36:07 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: Language Netiquette (Was: Re: Counter Digits)
Message-Id: <36ff3770.2123796@news.dircon.co.uk>

On Sun, 28 Mar 1999 21:34:28 -0800, lr@hpl.hp.com (Larry Rosler)
wrote:


>
>Was I culpable to continue an English-language thread in 
>de.comp.lang.perl (as I am doing now :-)?  

I would say that the culpability lies with the original poster for
cross posting in English to a German group.

>                                            Would any of you have scanned 
>the list of cross-posted groups with the thought of avoiding such an 
>'error'?  

My position on the 'Top 10 Crossposters chart' on some weeks would
seem to indicate not.

>         Having discovered a cross-post to de.comp.lang.perl, would you 
>have removed that group from the followups, 

Yes

>                                            or would you have posted a 
>separate response in German to that group, 

No I have no German

>                                           or would you have ignored the 
>issue?
>

Er - depends what mood I was in of course.

>War das wahrlich mein Fehler?
>

That was true my error ?  <babelfish dontcha lurv it>


fy ffaeledd ?
 
/J\


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

Date: Mon, 29 Mar 1999 09:37:12 GMT
From: ahoben@globeaccess.net
Subject: Need perl compiler
Message-Id: <7dnhk7$p2n$1@nnrp1.dejanews.com>

Who can help me have a freeware perl compiler for ibm compatible pc
Thanks very match

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 29 Mar 1999 09:39:40 +0200
From: Nir Leshem <nirl@zoran.co.il>
Subject: qe:operation on binary files
Message-Id: <36FF2E3C.50B5933C@zoran.co.il>

hi there
i wonder if anyone can help me:
 i need to bitswap each word in a binary file
(i.e 0000_0000_0000_0001 becomes 1000_0000_0000_0000)
how can i do that on  a binary file without the trivial solution of
translating  it into ASCII?????


 thanks
 nir.
--
--------------------------------------------------------------------
Nir Leshem
VLSI group                                   E-mail nirl@zoran.co.il
ZORAN Microelectronics LTD                     Tel : 972-4-8545911
Advanced Technology Center                       Fax : 972-4-8551550
P.O.B. 2495, Haifa 31204, Israel       www : http://www.zoran.com
--------------------------------------------------------------------




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

Date: Sun, 28 Mar 1999 22:13:33 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: RE to match one line of Larry's quote
Message-Id: <MPG.1168b9e132c02ca59897e5@nntp.hpl.hp.com>

In article <slrn7fu465.i3i.sholden@pgrad.cs.usyd.edu.au> on 29 Mar 1999 
05:33:57 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au >says...
> On 29 Mar 1999 05:21:46 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
> >
> >It also doesn't mention /n having any effect on newlines. And mentions
> >a different option to make /n match newlines
> 
> I think I may have meant \n... Oh well that indicates time to stop posting
> and get some coffee...

I thought (and still think) you meant:

  It also doesn't mention /m having any effect on newlines. And mentions
  a different option to make '.' match newlines

Specifically, /s .  Maybe you need more than coffee.  :-)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com


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

Date: 29 Mar 1999 06:31:43 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: RE to match one line of Larry's quote
Message-Id: <slrn7fu7if.jtm.sholden@pgrad.cs.usyd.edu.au>

On Sun, 28 Mar 1999 22:13:33 -0800, Larry Rosler <lr@hpl.hp.com> wrote:
>In article <slrn7fu465.i3i.sholden@pgrad.cs.usyd.edu.au> on 29 Mar 1999 
>05:33:57 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au >says...
>> On 29 Mar 1999 05:21:46 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
>> >
>> >It also doesn't mention /n having any effect on newlines. And mentions
>> >a different option to make /n match newlines
>> 
>> I think I may have meant \n... Oh well that indicates time to stop posting
>> and get some coffee...
>
>I thought (and still think) you meant:
>
>  It also doesn't mention /m having any effect on newlines. And mentions
>  a different option to make '.' match newlines
>
>Specifically, /s .  Maybe you need more than coffee.  :-)

Yes you are correct and all counts... Except I didn't want to mention /s
since it's in the docs and reader can find the damn thing themselves...

I hope the rest of my original post wasn't complete garbage as those two
lines seem to indicate.

I'm off to buy a rather large coffee, since I'm obviously in a worse state
than I thought... 

I'll just reread this post a couple of dozen times before typing :wq

-- 
Sam

I took the initiative in creating the Internet. 
	--Al Gore


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

Date: Mon, 29 Mar 1999 09:41:27 +0200
From: "Patrice M.I. Parmentier" <ppa@itmasters.com>
To: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: SIGPIPE and SIGCHLD Signals on win32. Please tell me what is wrong.
Message-Id: <36FF2EA6.DCD80776@itmasters.com>

Thks for help. You really read my msg and do not just answer to read the faq.

Ilya Zakharevich wrote:

> [A complimentary Cc of this posting was sent to Patrice M.I. Parmentier
> <ppa@itmasters.com>],
> who wrote in article <36FB9169.7364E4AD@itmasters.com>:
>
> > $SIG{PIPE} = sub {
> >  print "SIGPIPE called...\n";
> >  exit (-666);
> > };
> > $SIG{CHLD} = sub {
> >  print "SIGCHLD called...\n";
> >  exit (-555);
> > };
> >
> > $pid = open (HPIPE, "| buggything") or die "Cannot fork\n";
> > print "pid = $pid\n";
> >
> > $n = 0;
> > while (1)
> > {
> >  print HPIPE $n++ . "\n";
> > }
> > #########################################################
> >
> > This script just pipes a series of integers to a command 'buggything'. I
> > want that my script stop when the 'buggything' stops.
> >
> > All works fine on Solaris, AIX and HPUX, but not on NT.... Perlfaq and
> > other docs tell to catch sigpipe and sigchld.
>
> Perlfaq is (mostly) applicable to Unixish systems only (due to Tom's
> agenda - only systems with primitive sub-VMS APIs have a reason to
> exist).  Same for CookBook (which is excellent *if* you take it with a
> grain of salt outside of Unix).
>
> > I do not understand why
> > this script does not work on NT (the signal handlers are never called).
>
> Because they should not be called (at least if buggything does not
> exist).
>
> > Probably i am unable to understand the doc, so can somebody tell me what
> > is wrong???
>
> Obviously, you should (may?) get no SIGCHLD on NT: NT has sane process
> starting API, so with a sane implementation of "open" on the Perl side
> no child will be started.  (This is what happens, say, on OS/2.  But
> note that with older 5.004 vintage OS/2 perls open() will wrongly
> succeed.)

I agree. I just put a SIGCHLD handler because i received answers telling that
i must catch this handler,  because of the faq recommendation. So i put the
handler...

>
>
> The reason why you get no SIGPIPE is a little bit less obvious.  Since
> open() did not succeed, HPIPE is an invalid handle.  Thus no write to
> any kind of a pipe is performed, thus you can get no SIGPIPE.
>
> The only question is why open() succeeds.

Actually, opens always succeed. I guess that 'open' just reflects the success
of the launch of the cmd. On unix systems , open() performs a 'fork' then
'exec', so 'open' just reflects the success of the fork, which generally
succeeds even when the subsequent 'exec' fails. I do not know how is performed
the open(HPIPE,  "| prog") on NT, since the fork is not supported.
Nevertheless, I suppose that there is a analogous mechanism as on unix ; I
noticed hat open(HPIPE, "| prog") does not launch directly 'prog' but launches
'prog' via a CMD shell that launches prog. This is maybe the reason why open
always succeed as the CMD is (almost) always launched.

The question why the SIGPIPE is not sent remains, since open() succeeds and
'buggything' stopped after running for a short time. But i think you answer to
this with you next sentence:

> If buggything actually
> exists, it is a safe bet that non-delivery of SIGCHLD and SIGPIPE is
> just a shortcoming of the NT port.

Yes, i am forced to agree, too.

> I think the only workaround you
> have is to check the result of all the print()s
>
>     print FOO $bar or die "print failed: $!";

Yes, this is the way i am going to work. In addition, i check the output the
piped program to get more information (i must do the job via a file, or the NT
registry, since the open2 is not implemented on NT).

> Hope this helps,
> Ilya

--
 Patrice M.I. PARMENTIER
 Development Engineer




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

Date: 29 Mar 1999 08:17:59 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: SIGPIPE and SIGCHLD Signals on win32. Please tell me what is wrong.
Message-Id: <7dncvn$9gi$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Patrice M.I. Parmentier
<ppa@itmasters.com>],
who wrote in article <36FF2EA6.DCD80776@itmasters.com>:
> > The only question is why open() succeeds.
> 
> Actually, opens always succeed.

Oh, I see.  The silly (?) NT port tries to support

    system 'dir';

thus gives the command 'foo' in

    system 'foo';

to the interpreter even if it already knows that there is no
executable for 'foo' - in the hope that 'foo' is a shell-function.  I
consider this a broken decision, say, OS/2-related docs just says:

  If you want to run a shell command, ask shell to run this command,
  as in

    system 'cmd /c dir'

Ilya


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

Date: Mon, 29 Mar 1999 15:13:30 +0900
From: "Hojoo Moon" <hjmoon@netsgo.com>
Subject: sorting associative array by values
Message-Id: <1q6Jxoae#GA.273@news3.netsgo.com>

Hello, help me, please.

Does anybody know how to sort an associative array by values?
I know there is a way sorting an associative array by indexes:
       sort  keys(%arrary)

But I would like to get an easy way to sort:
      (apple 7, pear 15, mellon 5) ==> (pear 15, apple 7, mellon 5)

Thank you for your help in advance.

Hojoo Moon




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

Date: Mon, 29 Mar 1999 00:33:47 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sorting associative array by values
Message-Id: <MPG.1168dabe1a98f5679897e6@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <1q6Jxoae#GA.273@news3.netsgo.com> on Mon, 29 Mar 1999 
15:13:30 +0900, Hojoo Moon <hjmoon@netsgo.com >says...
> Does anybody know how to sort an associative array by values?
> I know there is a way sorting an associative array by indexes:
>        sort  keys(%arrary)
> 
> But I would like to get an easy way to sort:
>       (apple 7, pear 15, mellon 5) ==> (pear 15, apple 7, mellon 5)

perlfaq4:  "How do I sort a hash (optionally by value instead of key)?"

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personl/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 29 Mar 1999 08:44:45 GMT
From: gellyfish@gellyfish.com (Jonathan Stowe)
Subject: Re: Spider
Message-Id: <36ff3cbe.3481158@news.dircon.co.uk>

On 28 Mar 1999 21:16:47 GMT, solder182@aol.com (Solder182) wrote:

> BUT DO NOT REPLY TO THIS MESSAGE CONATCTS ME ANOTHER WAY

So we get several Dorises ....

/J\


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

Date: 29 Mar 1999 02:21:08 -0500
From: dha@panix.com (David H. Adler)
Subject: Re: Split with + , but no %2B
Message-Id: <slrn7fuaf1.i4f.dha@panix.com>

On Sat, 27 Mar 1999 16:33:26 -0800, David L. Cassell
<cassell@mail.cor.epa.gov> wrote:

>problem you're having.  Brian's guess was as good a guess as you

Actually, it's 'brian'.  See <http://www.brian-d-foy.com/style.html>.

Yes, I know I'm being nit-picky, but, in the words of Donald
Sutherland, "This is my *job*!".

best,

dave

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"A Marine that says 'gee whiz'?  What's he gonna do, storm the
Cunningham house?" - mst3k


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

Date: Mon, 29 Mar 1999 00:23:35 -0700
From: Rick Thomas <rick.thomas@ibm.net>
To: Wayne Keenan <tripix@tdi-net.freeserve.co.uk>
Subject: Re: The ONLY reg exp question I will EVER post again!
Message-Id: <36FF2A77.E8B35E43@ibm.net>

Wayne Keenan wrote:
> 
> If I promise to never post a Reg expression question again,  (I'm of to
> learn regexp, any easy start points?)
> (my last post , the ASCII < 32 started a snowball)
> please could someone tell me how to do this:
> 
> a $string containing multiple lines of
> [spaces] [number1] [spaces] [number2] [spaces] [number2] [spaces] [number3]
> [spaces] [number3][spaces] [number3] [newline]
> 
> where :
> [spaces]  is varying lengths of whitespace
> [newline] wont insult.
> [number1] is a positive integer            (max 6 chars)
> [number2] is a +/- integer                     (max 6 chars)
> [number3] is one of:                               (max 16 chars)
>                 [number]
>          or   [number]@
>          or    -
> 
> If I asked to be able to step through the $string line by line, this too
> would be handled
> by a regexpression I belive.
> 
> Many thanks you patient and talented people,
> 
> Wayne

Two possible versions follow, with test strings and prints.  Since I
wasn't sure of the nature of your third number, I set up the first
version to handle it as an integer, the second as a floating point
number.  Also note that the second regex allows for 0 or more spaces
before the first number (\s* instead of \s+) and allows for the
possibility of whitespace between the last number and the newline (\s*)
-- adjust as necessary.

Rick

###

$_  = " 1 -2 -2 3 3 3\n 4 5 5 - - -\n";

while (/\s+(\d+)\s+([-+]?\d+)\s+\2\s+(-|([-+]?\d+\@?))\s+\3\s+\3\n/g) {

	print "$1  $2  $3\n";

}


###


$_  = ' 1 -2 -2 3 3 3' . "\n" .
	' 4  5  5  -6.6e-64@  -6.6e-64@  -6.6e-64@' . "\n";

while
(/\s*(\d+)\s+([-+]?\d+)\s+\2\s+(-|([-+]?((\.\d+)|(\d+(\.\d+)?))([eE][-+]?\d+)?\@?))\s+\3\s+\3\s*\n/g)
{

	print "$1  $2  $3\n";

}


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

Date: Mon, 29 Mar 1999 00:50:41 -0700
From: Rick Thomas <rick.thomas@ibm.net>
To: Wayne Keenan <tripix@tdi-net.freeserve.co.uk>
Subject: Re: The ONLY reg exp question I will EVER post again!
Message-Id: <36FF30D1.E23562CC@ibm.net>

I realized just after sending the previous version that it would fail as
soon as a line was encountered that didn't match the pattern.  If you
want ALL lines tested, even if some fail, use something like the
following:

###

$string = ' 1 -2 -2 3 3 3' . "\n" .	# pass
	" foo bar \n" .		# fail	
	"\n" .			# fail
	' 4  5  5  -6.6e-64@  -6.6e-64@  -6.6e-64@' . "\n" .	# pass
	' 7  8  9  -9  9' . "\n";	# fail

while ($string =~ /[^\n]*\n/g) {	# will handle blank lines, too
	$_ = $&;
	if
(/\s*(\d+)\s+([-+]?\d+)\s+\2\s+(-|([-+]?((\.\d+)|(\d+(\.\d+)?))([eE][-+]?\d+)?\@?))\s+\3\s+\3\s*\n/g)
{
		print "$1  $2  $3\n";
	}

}

Rick


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

Date: Mon, 29 Mar 1999 11:02:31 +0200
From: Philip Newton <Philip.Newton@datenrevision.de>
Subject: Re: Values of 'true' and 'false'?
Message-Id: <36FF41A7.6729FD4F@datenrevision.de>

M.J.T. Guy wrote:
> 
> Philip Newton  <Philip.Newton@datenrevision.de> wrote:
> >Philip Newton wrote:
> >>
> >> first *non-zero* operand.
> >
> >make that: first false operand ('' or '0' or 0).
> 
> Oops.   I think you mean first *true* operand.

Oops. I think I do. (I kind of had it right the first time, then I broke
it.)

Cheers,
Philip


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

Date: Mon, 29 Mar 1999 10:23:07 +0300
From: Costis Angelis <loulou@ltt.ntua.gr>
Subject: Re: Very large float arrays and size problem
Message-Id: <36FF2A5B.FFE2096@ltt.ntua.gr>

Regarding this same subject, I think my question was not very well posed.
So, here it comes:

It seems like perl requires something of the order of 40 or 50 bytes to
store just one number. I estimate this as a simple division of the actual
memory requirements over the number of points. Now, either I am doing
something completely wrong, provoking such a behaviour, or this is plain
too much. In the former case, any suggestion would be appreciated. In the
latter, there must be some way to avoid that. I know there is no such thing
as a declaration of type or anything, but I think that there must be a way
to reduce memory requirements. Imagine scaling this up to 1,000,000 points.

Anyway, any help is still appreciated,

Costis Angelis

Costis Angelis wrote:

> I am facing the following situation. I want to read an ASCII file
>

> [snip]



> Why is so much memory used? Am I doing something way too wrong? FWIW,
> I have read every documentation page I could get my hands on. I can work
> around the problem, by handling each field independently, but this would
> mean parsing the data file something like 10 times. Not very efficient.
>
> Any help will be appreciated,
>
> TIA,
>
> Costis Angelis
> ----
> cangelis@hpc.ntua.gr  <--- preferred
> loulou@ltt.ntua.gr



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

Date: Mon, 29 Mar 1999 10:48:41 +0200
From: Ophir Marko <ophir@saifun.com>
Subject: Why am I stuck?
Message-Id: <36FF3E69.85ACCAED@saifun.com>

#! /local/perl/bin/perl -w
$file = <ARGV>;
open(FILE, "$file");
@lines = <FILE>;
split @lines;
$i=0;
open(FILE2, ">file");
while ($lines[$i] = "abc"){
 print FILE2 $line[$i];
 ++$i;
 }
close FILE;
close FILE2;

For some reason, the script continues in an infinite loop. I think it's
the ++i$ ?



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

Date: Mon, 29 Mar 1999 09:55:56 GMT
From: sgrantz@visi.com (Steve Grantz)
Subject: Re: Why am I stuck?
Message-Id: <M6IL2.277$7K6.43218@ptah.visi.com>

Ophir Marko (ophir@saifun.com) wrote:
: while ($lines[$i] = "abc"){
:  print FILE2 $line[$i];
:  ++$i;
:  }
: 
: For some reason, the script continues in an infinite loop. I think it's
: the ++i$ ?

Not the iteration. The compare.

You mean ($lines[$i] eq 'abc')
-SG

-- 
I despise those 'God Speaks' billboards.

That's why Satan Speaks at
http://www.visi.com/~sgrantz         		


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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