[13611] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1021 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 8 12:05:35 1999

Date: Fri, 8 Oct 1999 09:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939398716-v9-i1021@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 8 Oct 1999     Volume: 9 Number: 1021

Today's topics:
    Re: bug or feature? <ak@dasburo.de>
    Re: bug or feature? (Anno Siegel)
    Re: bug or feature? <uri@sysarch.com>
        Building perl with GCC 2.95.1 on solaris <ecmorgan@lucent.com>
    Re: Checking for processes schan6128@my-deja.com
    Re: Date variable (Larry Rosler)
    Re: Date variable <dave@dave.org.uk>
    Re: Date variable (ItsMe9905)
    Re: Delete a line in a file <sariq@texas.net>
    Re: Delete a line in a file <ilya@speakeasy.org>
    Re: Delete a line in a file <ilya@speakeasy.org>
    Re: Delete a line in a file <dove@synopsys.com>
    Re: Delete a line in a file <flavell@mail.cern.ch>
    Re: Does anyone know how to do ftp in perl? <owen@vvl.co.uk>
    Re: Easy way to emulate Unix's "sort" command? <ilya@speakeasy.org>
    Re: Easy way to emulate Unix's "sort" command? <ilya@speakeasy.org>
    Re: HELP: find the best REGEX... (Clinton Pierce)
    Re: HELP: find the best REGEX... <rhomberg@ife.ee.ethz.ch>
        How can I sort an array of hashes sorted by one of hash <Pascal.Chambre@inria.fr>
    Re: How can I sort an array of hashes sorted by one of  <ak@dasburo.de>
    Re: How can I sort an array of hashes sorted by one of  <dove@synopsys.com>
    Re: How can I sort an array of hashes sorted by one of  <Pascal.Chambre@inria.fr>
    Re: How to write an EOF in to a file? (Clinton Pierce)
    Re: Is there a good perl friendly text editor for WinNT <theglauber@my-deja.com>
        Looking for Perl script to parse Ada code <streesh@caci.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 08 Oct 1999 17:15:40 +0200
From: Alexander Knack <ak@dasburo.de>
Subject: Re: bug or feature?
Message-Id: <37FE0A9C.A129CE7B@dasburo.de>

> > newbies almost never find a real bug in perl. so please don't credit
> > yourself as doing that. you have run into a very common newbie bug in
> > your own code. read perlre to learn more about why that split doesn't do
> > what you expect.

come on. just because i've forgot that split takes regex as first
argument there
is no need to blame me newbie.
and, instead of notifying me about this, you attempt to trash the news
with
your emotional problems.
-- 
+--------------------------------------------------------------------+
| Alexander Knack  ........Entropie erfordert keine Wartung .........|
|  dasburo.de      ..................................................| 
+--------------------------------------------------------------------+


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

Date: 8 Oct 1999 15:27:56 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: bug or feature?
Message-Id: <7tl2hs$2nr$1@lublin.zrz.tu-berlin.de>

Alexander Knack  <ak@dasburo.de> wrote in comp.lang.perl.misc:
>> > newbies almost never find a real bug in perl. so please don't credit
>> > yourself as doing that. you have run into a very common newbie bug in
>> > your own code. read perlre to learn more about why that split doesn't do
>> > what you expect.
>
>come on. just because i've forgot that split takes regex as first
>argument there
>is no need to blame me newbie.

Forgetting how a parameter works happens to everyone.  Shouting
*bug* when it happens brands you as a newbie.

Anno


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

Date: 08 Oct 1999 11:55:34 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: bug or feature?
Message-Id: <x7iu4honih.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

  AS> Alexander Knack  <ak@dasburo.de> wrote in comp.lang.perl.misc:
  >>> > newbies almost never find a real bug in perl. so please don't credit
  >>> > yourself as doing that. you have run into a very common newbie bug in
  >>> > your own code. read perlre to learn more about why that split doesn't do
  >>> > what you expect.
  >> 
  >> come on. just because i've forgot that split takes regex as first
  >> argument there
  >> is no need to blame me newbie.

  AS> Forgetting how a parameter works happens to everyone.  Shouting
  AS> *bug* when it happens brands you as a newbie.

thank you, anno. that was my whole point. we get lots of forgetting to
backwhack . and | in split and regexes. it happens enough to be an FAQ
already (it should be in there if it isn't). but calling it a possible
bug (in the SUBJECT no less) got in my craw.

so alexander, ask for help with you perl code, and you will get
it. claiming potential bugs without any backing or proper understanding
of the operators (rtfm must be done) is flame bait. that kind of fud
scares away the other newbies and PHB's.

a bug in perl! i can't allow perl to be used on my highly secure nt box!
we must pay $$$ for some unsupportable bloatware solution which is
guaranteed bug free or you can call this 900 number to complain about
it.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Fri, 08 Oct 1999 10:08:00 -0400
From: Edward C Morgan <ecmorgan@lucent.com>
Subject: Building perl with GCC 2.95.1 on solaris
Message-Id: <37FDFAC0.B165617E@lucent.com>

I'm currently using a sparc_solaris2.6 gcc compiler version 2.95.1
To build that compiler, I had to abandon the /usr/ccs/bin/as and ld assembler
and linker
and use gnu's as and ld versions:
2.9.5.0.6

When I'm building perl, I run:
    sh Configure -Dcc=gcc -des
Which forces me back to using /usr/ccs/bin for the assembler and linker.
I get several messages stating:

     Finding dependencies for sv.o.
     gcc: file path prefix `/usr/ccs/bin/' never used

I get the following error when I type 'make':
$ make
`sh  cflags libperl.a miniperlmain.o`  miniperlmain.c
          CCCMD =  gcc -B/usr/ccs/bin/ -B/usr/ccs/bin/ -DPERL_CORE -c
-I/usr/local/include -I/opt/local/include -I/opt/gnu/include -O
`sh  cflags libperl.a perl.o`  perl.c
          CCCMD =  gcc -B/usr/ccs/bin/ -B/usr/ccs/bin/ -DPERL_CORE -c
-I/usr/local/include -I/opt/local/include -I/opt/gnu/include -O
/usr/ccs/bin/as: "/tmp/cceM2TAa.s", line 1686: error: unknown opcode
".subsection"
/usr/ccs/bin/as: "/tmp/cceM2TAa.s", line 1686: error: statement syntax
/usr/ccs/bin/as: "/tmp/cceM2TAa.s", line 1810: error: unknown opcode
".previous"
/usr/ccs/bin/as: "/tmp/cceM2TAa.s", line 1810: error: statement syntax
/usr/ccs/bin/as: "/tmp/cceM2TAa.s", line 4222: error: unknown opcode
".subsection"
/usr/ccs/bin/as: "/tmp/cceM2TAa.s", line 4222: error: statement syntax
/usr/ccs/bin/as: "/tmp/cceM2TAa.s", line 4345: error: unknown opcode
".previous"
/usr/ccs/bin/as: "/tmp/cceM2TAa.s", line 4345: error: statement syntax


The only way to compile correctly is to take out the "-B/usr/ccs/bin/" flags
from gcc inside
config.sh and reconfiguring.


Is there an easier way of doing that?

--
=========================================
 Edward C. Morgan
 Email:  ecmorgan@lucent.com
=========================================





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

Date: Fri, 08 Oct 1999 15:39:01 GMT
From: schan6128@my-deja.com
Subject: Re: Checking for processes
Message-Id: <7tl36k$o6m$1@nnrp1.deja.com>



>
> If you have the process' PID, you can use kill() with a zero signal to
see
> if it's alive.

I've been trying to use the kill with a zero signal, but it is killing
the process.  Is there anyway to just simply monitor the process and not
kill it?  Basically what I am trying to do is to set up sort of a
guardian process.  But thanks for all your help so far.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 8 Oct 1999 07:40:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Date variable
Message-Id: <MPG.1267a2477b7d374398a05e@nntp.hpl.hp.com>

In article <37FDF122.D5E9400B@forumnett.no> on Fri, 08 Oct 1999 15:26:58 
+0200, Hauk Langlo <hauk@forumnett.no> says...
> Try thisone:
> 
> ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
> localtime(time());	
> $mon ++;
> 
> time() is the number of seconds since 1970. Localtime "convert" this
> number into the more practical values you see above.

If you are going to quote the documentation, don't leave out the most 
important part:

  $year += 1900;

See you on 1/1/100 !

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


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

Date: Fri, 08 Oct 1999 16:48:32 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Date variable
Message-Id: <ERL+N6Y21msOGb9Y36Rcc+KtMM8M@4ax.com>

On Fri, 08 Oct 1999 15:26:58 +0200, Hauk Langlo <hauk@forumnett.no>
wrote:

>Try thisone:
>
>($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
>localtime(time());	
>$mon ++;
$year += 1900;
>
>time() is the number of seconds since 1970. Localtime "convert" this
>number into the more practical values you see above.

And localtime defaults to using 'time' is passed no arguments, so
localtime(time()) is tautalogical.

Dave...

--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>


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

Date: 08 Oct 1999 16:00:45 GMT
From: itsme9905@aol.comnojunk (ItsMe9905)
Subject: Re: Date variable
Message-Id: <19991008120045.18179.00000165@ng-da1.aol.com>

Try $the_date = `/bin/date`;  If that doesn't work ask your web admin the path
to te date module(?).


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

Date: Fri, 08 Oct 1999 09:10:19 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Delete a line in a file
Message-Id: <37FDFB4B.46D118F5@texas.net>

Ilya wrote:
> 
> Tom Briles <sariq@texas.net> wrote:
> > Gaetan wrote:
> >>
> >> What can i do to delete just one line in a file.
> 
> > You can RTFM.  Specifically, perlfaq5:
> 
> > "How do I change one line in a file/delete a line in a file/insert a
> > line in the middle of a file/append to the beginning of a file?"
> 
> It is a  fallacy that the FAQ  can satisfy the needs of  everyone. 

Of course it can't.  Who claimed that it could?

> That's why
> newsgrops  exist to complement  it.

Ummm...no.  Newsgroups exist for a number of reasons, but complementing
FAQs isn't one.

> FAQ  are good

Yes.  And you should try reading the answers to them sometime.

> but sometimes  users have
> unique  variations  of  the  same   problem  that  requires  a  less  standard
> response. Just because there is a FAQ entry, does not mean the question should
> not be asked/answered here.

Then the poster should state, "I'm doing this, and the FAQ said to do
that.  But I can't quite figure out how to make it fit my unique
situation.  This is what I've tried so far."

If you read the quote from the original post, the words match nearly
exactly to the FAQ.  Thus, the answer is in the FAQ.

> So... Asking FAQ questions is not a waste of time,
> personally I want to see these kinds  of questions. What's a waste of time and
> noise is people saying "Oh! It is in the FAQ! Go read it! Don't ask here".

Wrong, wrong, wrong - as I'm sure others will be quick to point out,
also.

The FAQ exists for a reason.  Use it.  Read it.  If you find a bug or
have a quibble, report it.
 
> As to the question,  there are many many ways of doing  that. Could you give a
> more  detailed example  of what  you  are trying  to accomplish?   If you  are
> interfacing with the system file, I would use "grep -v". If you have your data
> in an array, I would use regular expressions and pattern matching.

Sheesh...you *really* need to read the FAQ.

> The one book that covers it really well is: _Perl By Example_ by Quigley.  The
> _Perl Cookbook_ is also excellent.  I  somehow have not found much use for the
> Camel book.

Preferring Quigley over Camel?  That's so absurd that I'm now wondering
why I bothered to reply in the first place...you won't listen and/or you
won't understand.

But then, perhaps someone else will.

- Tom


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

Date: Fri, 08 Oct 1999 15:29:19 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Delete a line in a file
Message-Id: <rvs3efsbh1s45@corp.supernews.com>

David Cassell <cassell@mail.cor.epa.gov> wrote:
> Ilya wrote:
> [snip]
>> It is a  fallacy that the FAQ  can satisfy the needs of  everyone.

> It isn't claimed to be so.

>>  That's why
>> newsgrops  exist to complement  it.

> No, newsgroups exist for other reasons.  

That's your personal opinion, thank you for sharing it.

Every person has his or her understanding of the newsgroup(s).  There isn't
some biblical principle regarding that. In short - if some people want to ask
FAQ questions here, let them. If you don't like that - don't read it.

	==============================================================
	Paper money eventually returns to its intrinsic value -- zero.
                 				  -Voltaire
	==============================================================


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

Date: Fri, 08 Oct 1999 15:31:25 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Delete a line in a file
Message-Id: <rvs3id4dh1s57@corp.supernews.com>

Tom Briles <sariq@texas.net> wrote:

> Ummm...no.  Newsgroups exist for a number of reasons, but complementing
> FAQs isn't one.

Your opinion.

Newsgroups exist for whatever purpose the person accessing them reads them.
It is different in each case.  


	==============================================================
	Paper money eventually returns to its intrinsic value -- zero.
                 				  -Voltaire
	==============================================================


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

Date: Fri, 08 Oct 1999 08:32:33 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: Delete a line in a file
Message-Id: <37FE0E91.4AF800F@synopsys.com>

Hi David,

David Cassell wrote:

> Ummm, David, is there a reason why you didn't cite the program
> from the FAQ which does this in a shorter, cleaner, safer,
> better manner?

Three reasons:

The first reason is I checked the FAQ and it did provide the general case
of modifying a line, but didn't talk about the specifics of deleting a
line.  Plus there was the interesting case of deleting *every* line that
matches text or just the first one or what.

The second reason is that my personal philosophy in helping people with
this sort of stuff is to provide full examples if I can and if I have
time.  I know a lot of people on this newsgroup want to force people to
read the FAQs and chastise folks who don't.  My general belief is that
this newsgroup exists to try to improve the expertise of the entire Perl
community (newbies included), and my personal feeling is that providing
an example and mentioning how to find out is better at achieving that
goal than berating people for not reading the FAQs or providing pointers
to examples that are general solutions, leaving the details to the person
looking for help.

This is my personal philosophy of posting on this newsgroup, and I don't
think people are wrong for reacting to simple questions with a quick
pointer to 'perldoc -q whatever'.

In this particular thread, a lot of people have already mentioned the
FAQs, so I just provided the example.

Finally, I'd like to improve my own experience, and by providing examples
to new folks with the code, I get to practice my coding style and make
sure that I'm catching everything.

Which leads me to....

>  But you forgot to check the return on your
> rename()s.

Thanks. I should have done that.  I meant to do that.  Ah well.

> And your regex may not do the right thing if someone
> specifies a $delete_line like "lots of stars***!"

Oops again.  I guess I should have used an 'eq' rather than a regular
expression since my experience with those things is so dang limited and I
could have done this with a direct comparison.

>
> But you used -w and strict, and did most things right.
> Setting a good example there.
>

Thanks.

-=dav




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

Date: Fri, 8 Oct 1999 17:39:06 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Delete a line in a file
Message-Id: <Pine.HPP.3.95a.991008163729.12772A-100000@hpplus01.cern.ch>


On Thu, 7 Oct 1999, Ilya attempted a line in justification:

> It is a  fallacy that the FAQ  can satisfy the needs of  everyone. 

It _would_ be a fallacy, if anyone were claiming it.  What we have here
is a Straw Man, misidentified as a fallacy.

> That's why
> newsgrops  exist to complement  it.  

I would rather say that usenet FAQs exist to complement newsgropes.

> FAQ  are good,  but sometimes  users have
> unique  variations  of  the  same   problem  that  requires  a  less  standard
> response. 

Which was demonstrably not the case here, so you're just bolstering up
that straw man.

> Just because there is a FAQ entry, does not mean the question should
> not be asked/answered here.

"The" question?  Please make up your mind.  If _the_ question is
answered in the FAQ, then it has no business being posed here.  If the
specific question is sufficiently subtly different from "the" question,
then the thoughtful usenaut will call attention to the FAQ and then show
what it is about their problem that calls for additional discussion.

> So... Asking FAQ questions is not a waste of time,
  ^^
This does not follow from your previous argument.  It is also
demonstrably untrue, since the asking of FAQs wastes a great deal of
time and effort here, and for reasons that have been cogently argued
many times (another waste of effort), one of them quite recently and on
this very group.

> personally I want to see these kinds  of questions. 

There's plenty of them waiting for you in the FAQ, why not read them
there?

> What's a waste of time and
> noise is people saying "Oh! It is in the FAQ! Go read it! Don't ask here".

Yes, it _is_ a waste of time.  Caused only by people asking FAQs.
But as long as they won't stop asking them, the waste of time is doomed
to continue.

On ciwah we discussed whether it would be better for the regulars to
stop answering FAQs entirely, and leave the questioners to the tender
mercies of those other participants who haven't read the FAQs. 

good luck




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

Date: Fri, 08 Oct 1999 15:22:06 +0100
From: Owen Brydon <owen@vvl.co.uk>
Subject: Re: Does anyone know how to do ftp in perl?
Message-Id: <37FDFE0E.51D09589@vvl.co.uk>

cheis01@yahoo.com wrote:
> 
> Does anyone know how to do ftp in perl?

perldoc -q ftp


-- 
Owen Brydon, Test Development Engineer        
VLSI Vision Ltd
http://www.vvl.co.uk
owen@vvl.co.uk


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

Date: Fri, 08 Oct 1999 15:43:41 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Easy way to emulate Unix's "sort" command?
Message-Id: <rvs49di0h1s30@corp.supernews.com>

Eric The Read <emschwar@rmi.net> wrote:
> "Paul Glidden" <paul.glidden@unisys.com> writes:
>> Somebody else, whose attribution he snipped, wrote:
>> >Doh!  I'll certainly peruse the FAQs next time; I didn't think the
>> >help was that elaborate!
>>
>> Don't be too upset about it, I hate reading those things, sometimes the
>> explanations are just not up to snuff, that's where a book like the camel
>> comes in handy.

> Not up to snuff how?  The FAQs are going to be up-to-date and have
> current information; even the most recent Camel is still several
> revisions out of date.  The FAQs are also free, and come with Perl.  The
> Camel, while a good book (and it was worth the money I paid for it) costs
> money.

> BTW, please put your replies *after* the text you're replying to; human
> minds don't work like a game of Jeopardy.

You might find it amazing that the FAQs don't satisfy the needs of every user
- that's why they post here. Quite obvious, don't you think?


	==============================================================
	Paper money eventually returns to its intrinsic value -- zero.
                 				  -Voltaire
	==============================================================


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

Date: Fri, 08 Oct 1999 15:45:56 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Easy way to emulate Unix's "sort" command?
Message-Id: <rvs4dkm9h1s13@corp.supernews.com>

Jim Hutchison <jimhutchison@metronet.ca> wrote:

> Thanks Jonathan.  As I'm still digesting the basics, the FAQ wasn't clear on
> how to do a simple numeric sort on, say, the 3rd column of a multi-column
> table.

Imagine that. 

A FAQ will never substitute interactive help. If that were the case, we would
not need schols, or classes, or any other interactive activities, including
Usenet.

	==============================================================
	Paper money eventually returns to its intrinsic value -- zero.
                 				  -Voltaire
	==============================================================


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

Date: Fri, 08 Oct 1999 14:05:52 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: HELP: find the best REGEX...
Message-Id: <3807f8b2.249401850@news.ford.com>

[poster cc'd in e-mail]

On 8 Oct 1999 13:21:41 GMT, "cyshieh" <cyshieh@sis.com.tw> wrote:
>$_="01010LLHHLLHHLXHH010LXH11LLH001";
>    |^^^^^^^^^^^^^^^^^^||^^^^^^^^^^^^^^^^^^^|
>    string A                      string B = 14 (length)
>
>I want to find out if there has any 'X' character in string A, but
>I dont care the 'X' character in string B.
>If the length of $_ is about 500 and the length of string A is 60, the
>following is my solution (for this example).
>If there has any other faster expression?
>Thanks!
>
>/^.{5}.*?X+?/ and $' =~ /.{14}$/

Uh, if all you're looking for are simple strings ('X') in fixed ranges
just use substr and index like this:

	$_="abcdefghijklmnopqrstuvwxyz";
	print "yes" if ( index(substr($_, 0, 10), 'c' ) >= 0);

This looks for 'c' in the first 11 characters of $_.  

For fixed-length substrings and simple characters, regular expressions can
be overkill sometimes.

-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: Fri, 08 Oct 1999 16:50:44 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
To: cyshieh <cyshieh@sis.com.tw>
Subject: Re: HELP: find the best REGEX...
Message-Id: <37FE04C4.194223B0@ife.ee.ethz.ch>

cyshieh wrote:
> 
> $_="01010LLHHLLHHLXHH010LXH11LLH001";
>                   |^^^^^^^^^^^^^^^^^^||^^^^^^^^^^^^^^^^^^^|
>                        string A                      string B = 14 (length)
> 
> I want to find out if there has any 'X' character in string A, but
> I dont care the 'X' character in string B.
> If the length of $_ is about 500 and the length of string A is 60, the
> following is my solution (for this example).
> If there has any other faster expression?
> Thanks!
> 
> /^.{5}.*?X+?/ and $' =~ /.{14}$/

cut away the string B, then look for your undecided values:

$_ = "01010LLHHLLHHLXHH010LXH11LLH001";
substr($_,0,-14)=~/X/ and print "there's an X in A"

- Alex


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

Date: Fri, 08 Oct 1999 16:45:16 +0200
From: Pascal Chambre <Pascal.Chambre@inria.fr>
Subject: How can I sort an array of hashes sorted by one of hash keys ?
Message-Id: <37FE037B.4B47748B@inria.fr>

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

Say I have an array @a of hashes %h.

How can I write something like :

@a = sort by $h{$key} @a;

Thanks you,

Pascal.Chambre@inria.fr




--------------0DAEBB936E3D4C68BCCB6875
Content-Type: text/x-vcard; charset=us-ascii;
 name="Pascal.Chambre.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Pascal Chambre
Content-Disposition: attachment;
 filename="Pascal.Chambre.vcf"

begin:vcard 
n:Chambre;Pascal
x-mozilla-html:TRUE
org:GENE-IT
adr:;;;;;;
version:2.1
email;internet:Pascal.Chambre@inria.fr
title:PhD
x-mozilla-cpt:;0
fn:Pascal Chambre
end:vcard

--------------0DAEBB936E3D4C68BCCB6875--



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

Date: Fri, 08 Oct 1999 17:09:13 +0200
From: Alexander Knack <ak@dasburo.de>
To: Pascal Chambre <Pascal.Chambre@inria.fr>
Subject: Re: How can I sort an array of hashes sorted by one of hash keys ?
Message-Id: <37FE0919.38F802AA@dasburo.de>

@a = sort { $a->{key} cmp $b->{key} } @a;
-- 
+--------------------------------------------------------------------+
| Alexander Knack  ........Entropie erfordert keine Wartung .........|
|  dasburo.de      ..................................................| 
+--------------------------------------------------------------------+


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

Date: Fri, 08 Oct 1999 08:14:23 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: How can I sort an array of hashes sorted by one of hash keys ?
Message-Id: <37FE0A4F.6E12B425@synopsys.com>

Hi Pascal,

Pascal Chambre wrote:

> Say I have an array @a of hashes %h.
>
> How can I write something like :
>
> @a = sort by $h{$key} @a;

You'll want to use a sort subroutine.

sub by_key {

    $a->{$key} <=> $b->{$key};

}

You'd then invoke it by using it after the sort command as follows:

@sorted_array = sort by_key @array;

Hope this helps,
-=dav




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

Date: Fri, 08 Oct 1999 17:32:05 +0200
From: Pascal Chambre <Pascal.Chambre@inria.fr>
Subject: Re: How can I sort an array of hashes sorted by one of hash keys ?
Message-Id: <37FE0E74.437512EE@inria.fr>

This is a multi-part message in MIME format.
--------------256BD6DE363A905E864CB1EC
Content-Type: multipart/alternative;
 boundary="------------F1F4A92CA173FBF16E11AB5F"


--------------F1F4A92CA173FBF16E11AB5F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi David,

It exactly works.  I read the FAQ and I realise I missed $a->{} <=>
$b->{}. But can we parametrise the by_key sub for instance :

@a = sort by_key($key) @a;

I guess we could use a closure..

Anyway I can use as any sub per key in my hash.

Dont loose your time again.

Thanks you very much,

Pascal.


David Amann wrote:

> Hi Pascal,
>
> Pascal Chambre wrote:
>
> > Say I have an array @a of hashes %h.
> >
> > How can I write something like :
> >
> > @a = sort by $h{$key} @a;
>
> You'll want to use a sort subroutine.
>
> sub by_key {
>
>     $a->{$key} <=> $b->{$key};
>
> }
>
> You'd then invoke it by using it after the sort command as follows:
>
> @sorted_array = sort by_key @array;
>
> Hope this helps,
> -=dav

--
----------------------
Pascal Chambre
GENE-IT
INRIA Rocquencourt
78156 Le Chesnay Cedex
FRANCE
job: +33 (0)1 39 63 57 91
mob: +33 (0)6 60 18 06 56
fax: +33 (0)1 39 63 54 69
----------------------



--------------F1F4A92CA173FBF16E11AB5F
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi David,
<p>It exactly works.&nbsp; I read the FAQ and I realise I missed $a->{}&nbsp;&lt;=>
$b->{}. But can we parametrise the by_key sub for instance :
<p>@a = sort by_key($key) @a;
<p>I&nbsp;guess we could use a closure..
<p>Anyway I can use as any sub per key in my hash.
<p>Dont loose your time again.
<p>Thanks you very much,
<p>Pascal.
<br>&nbsp;
<p>David Amann wrote:
<blockquote TYPE=CITE>Hi Pascal,
<p>Pascal Chambre wrote:
<p>> Say I have an array @a of hashes %h.
<br>>
<br>> How can I write something like :
<br>>
<br>> @a = sort by $h{$key} @a;
<p>You'll want to use a sort subroutine.
<p>sub by_key {
<p>&nbsp;&nbsp;&nbsp; $a->{$key} &lt;=> $b->{$key};
<p>}
<p>You'd then invoke it by using it after the sort command as follows:
<p>@sorted_array = sort by_key @array;
<p>Hope this helps,
<br>-=dav</blockquote>

<pre>--&nbsp;
----------------------
Pascal Chambre
GENE-IT
INRIA Rocquencourt
78156 Le Chesnay Cedex
FRANCE
job: +33 (0)1 39 63 57 91
mob: +33 (0)6 60 18 06 56
fax: +33 (0)1 39 63 54 69&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
----------------------</pre>
&nbsp;</html>

--------------F1F4A92CA173FBF16E11AB5F--

--------------256BD6DE363A905E864CB1EC
Content-Type: text/x-vcard; charset=us-ascii;
 name="Pascal.Chambre.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Pascal Chambre
Content-Disposition: attachment;
 filename="Pascal.Chambre.vcf"

begin:vcard 
n:Chambre;Pascal
x-mozilla-html:TRUE
org:GENE-IT
adr:;;;;;;
version:2.1
email;internet:Pascal.Chambre@inria.fr
title:PhD
x-mozilla-cpt:;0
fn:Pascal Chambre
end:vcard

--------------256BD6DE363A905E864CB1EC--



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

Date: Fri, 08 Oct 1999 13:28:04 GMT
From: cpierce1@ford.com (Clinton Pierce)
Subject: Re: How to write an EOF in to a file?
Message-Id: <3805eff0.247159065@news.ford.com>

[poster cc'd in e-mail]

On Fri, 8 Oct 1999 17:23:25 +0800, "Daniel Y.L." <linyong2000@990.net>
wrote:
>I want to know how to write an EOF flag to a file?

EOF is not a thing.  It's a condition, a state of being.  

In the same way that "dead" is not a thing.  You cannot have a dead, you
cannot hold a dead.  You cannot give away a dead, and you can't write a
dead to a file.

Once you get that concept down, you should really go back and examine your
code.

># undef $/;
># $contents = <FILEHANDLE>;        # it only read one line, it is correct;
>while (<FILEHANDLE>) {
>    $contents .= <FILEHANDLE>;      # hang up, seems no EOF;
>}
>
>I also tried to clear the $INPUTY_RECROD_SEPARATOR, $/ to read the whole
>file contents.  But, it also hang up.

Small hint.  while(<FILEHANDLE>) reads a line from that filehandle, and
places it in $_ (which you never use).  $contents.=<FILEHANDLE> reads
ANOTHER line, and appends it to $contents.  

This is probably a bug.


-- 
Clinton A. Pierce       "If you rush a Miracle Man, you get rotten
clintp@geeksalad.org        Miracles."  -- Miracle Max, The Princess Bride
http://www.geeksalad.org


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

Date: Fri, 08 Oct 1999 14:52:05 GMT
From: The Glauber <theglauber@my-deja.com>
Subject: Re: Is there a good perl friendly text editor for WinNT?
Message-Id: <7tl0ee$mag$1@nnrp1.deja.com>

Any decent programming editor for Windoze will support Perl. I use vim
(http://www.vim.org), because it works the same in Unix and Windows. Vim can
be compiled in such a way that you can run Perl commands from inside the
editor. Syntax coloring and block indentation work very well with Perl.

glauber


In article <37FDEE4A.B6CA7149@forumnett.no>,
  Hauk Langlo <hauk@forumnett.no> wrote:
> Hi there. I'm sure many of you will suggest I should install Linux and
> use eMacs as I hear this all day long at work. I do not however think
> I'm ripe for Linux just yet, but I do miss a lot of the fancy functions
> in editors like eMacs. I'm currently using Ultra Edit 6.00a wich is good
> in many ways. I do however miss important things like function block
> deflating or function jumping along with a more effective auto indenting
> function. Colour coding for Perl is also a must. I would be very happy
> if anyone know about an editor that will let me do that and even more
> happy if you would reply by mail : )
>
> Regards Hauk Langlo
>
> --
> __________________________________________________________
>
> Hauk Langlo                        EXTEND AS
> ForumNett Online AS endret 18/5-99 navn til extend as
> PHONE +47 73546100 - CELL +47 93438940 - FAX +47 73546105
> MAIL: hauk@extend.no - INFO: http://www.extend.no
>

--
Glauber Ribeiro
theglauber@my-deja.com
"Opinions stated are my own and not representative of Experian"


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 08 Oct 1999 15:00:17 GMT
From: "Streesh" <streesh@caci.com>
Subject: Looking for Perl script to parse Ada code
Message-Id: <5GnL3.54$DZ5.1376335@dca1-nnrp1.news.digex.net>

Does anyone know where I might find this?

Thanks

Steve




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 1021
**************************************


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