[13886] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1296 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 8 14:27:59 1999

Date: Mon, 8 Nov 1999 11:27:49 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942089269-v9-i1296@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 8 Nov 1999     Volume: 9 Number: 1296

Today's topics:
        DBI ERROR HANDLING (Eisen Chao)
    Re: DBI ERROR HANDLING <cassell@mail.cor.epa.gov>
    Re: DBI ERROR HANDLING <gellyfish@gellyfish.com>
    Re: DBI prepare error when running select stmt <gellyfish@gellyfish.com>
    Re: dbm file broken <rootbeer@redcat.com>
    Re: dbm file broken (Kragen Sitaker)
    Re: DBM files.... HELP <gellyfish@gellyfish.com>
        Downloading files <FH16@le.ac.uk>
    Re: Downloading files <moseley@best.com>
    Re: Downloading files <gellyfish@gellyfish.com>
        downloading pdf file with correct name martingormley@my-deja.com
    Re: duplicates in an array <cassell@mail.cor.epa.gov>
        Dynamic Configuration File rmore1@my-deja.com
    Re: Dynamic Configuration File <rootbeer@redcat.com>
    Re: Dynamic Configuration File <gellyfish@gellyfish.com>
    Re: efficient diff algorithm <howard@neuro-physiol.med.uni-goettingen.de>
    Re: efficient diff algorithm <mel@disc.com>
        exemplify Perl (R L Samuell)
    Re: exemplify Perl <cassell@mail.cor.epa.gov>
        expect module <maurerf@post.ch>
    Re: Extract string <gellyfish@gellyfish.com>
    Re: FAQ 3.9: Is there an IDE or Windows Perl Editor? <gellyfish@gellyfish.com>
    Re: FAQ 4.28: How do I capitalize all the words on one  <cassell@mail.cor.epa.gov>
    Re: FAQ 4.33: How do I find the soundex value of a stri <cassell@mail.cor.epa.gov>
    Re: FAQ 4.36: Why don't my E<lt>E<lt>HERE documents wor <cassell@mail.cor.epa.gov>
    Re: FAQ 4.49: How do I permute N elements of a list? <skilchen@swissonline.ch>
    Re: FAQ 4.55: How do I look up a hash element by value? (Dan Wilga)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 05 Nov 1999 16:05:06 GMT
From: echao@interaccess.com (Eisen Chao)
Subject: DBI ERROR HANDLING
Message-Id: <s2601ieqhpc49@corp.supernews.com>

Hi to All:

Anybody have docuemntation on how the error handling
works for DBI ? I have some examples, but not what
the return values signify.

I'd love to get a copy of TIM BUNCE's new book from
O'Reilly but that will be Jan-Fed 2000 (Yikes!).

Thanks in Advance

Eisen


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

Date: Fri, 05 Nov 1999 14:40:17 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: DBI ERROR HANDLING
Message-Id: <38235CD1.45E51C6@mail.cor.epa.gov>

Eisen Chao wrote:
> 
> Hi to All:

Howdy!

> Anybody have docuemntation on how the error handling
> works for DBI ? I have some examples, but not what
> the return values signify.

Use the ppm program to grab DBI from ActiveState's website.
It installs with lots of DBI examples, and even the DBI FAQ.
 
> I'd love to get a copy of TIM BUNCE's new book from
> O'Reilly but that will be Jan-Fed 2000 (Yikes!).

Actually, it may be even later than that.  I just talked
to an O'Reilly rep Wednesday at a book sale, and found
that out.  But, on the upside, I did get another swell
t-shirt.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 6 Nov 1999 12:06:20 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBI ERROR HANDLING
Message-Id: <8015js$a71$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Eisen Chao <echao@interaccess.com> wrote:
> Hi to All:
> 
> Anybody have docuemntation on how the error handling
> works for DBI ? I have some examples, but not what
> the return values signify.
> 

DBI error codes are almost certainly specific to the database engine - you
will probably want to look at $DBI::err and $DBI::errstr in concert with
the documentation for your database engine.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 6 Nov 1999 16:16:51 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBI prepare error when running select stmt
Message-Id: <801k9j$b25$1@gellyfish.btinternet.com>

On Mon, 01 Nov 1999 21:18:57 GMT slicks78@my-deja.com wrote:
> In article <7vehtm$488$1@gellyfish.btinternet.com>,
>   Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>> On Fri, 29 Oct 1999 19:44:54 GMT slicks78@my-deja.com wrote:
>> > I am having a prepare error returned when trying to run a SQL select
>> > statement to SQL Server. The SQL is dynamically generated.  Some of
> the
>> > input is coming from a multi line select box w/ values appended with
>> > commas for parsing.  I think this might be some of the problem.
>> >
>> > The code:
>> >
>> > sub getMemberID
>> > {
>> > 	local($sMemberIDSql, @Results,$ListofNames,$name);
>> >
>> > 	$ListofNames = shift;
>> > 	$ListofNames =~ s/,/','/isg;
>> > 	$ListofNames = "'" . $ListofNames . "'";
>> > 	$sMemberIDSql = qq|SELECT tblMember.MemberId FROM tblMember
>> > WHERE tblMember.MemberName in ($ListofNames);|;
>> >
>> > 	@Results = &executeSQLStatement($sMemberIDSql);
>> > 	return @Results;
>> > }
>> >
>> > executeSQLStatement performs a DBI prepare and execute statement and
>> > then returns an array of results.
>> >
>>
>> <unmatched quote error>
>>
>> $ListofNames = join ','. map { qq{'$_'} } split /,/, $ListofNames;
>>
> 
> I used your method to format the list of names for the SQL stmt
> ($ListofNames).  Unfortunately, the problem does not lie in the
> construction of the list.  It turns out that an obscure character is
> appended to each value selected in a multiple input select box. The
> character is not shown when I try to print out the input.
> 
> Do you know what that character may be?
> Is there a special delimiter between each selected value in the multi
> line select box?
> 

I think that the problem is to do with they way that you are parsing the
input then - however as you dont show the code that does this then there
isnt much we can say.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 5 Nov 1999 09:16:11 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: dbm file broken
Message-Id: <Pine.GSO.4.10.9911050914100.29670-100000@user2.teleport.com>

On Fri, 5 Nov 1999, jeroen dijkmeijer wrote:

> Does anyone have a clue what could have been wrong, or can anybody
> think of a convincing explanation.

The latter:

The hardware change exacerbated a little-known bug in your DBM* library
routines, causing them to return inaccurate data during some fetch
operations. Fortunately, recompiling perl (including the 'make test' step)
should fix the problem.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 06 Nov 1999 22:29:53 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: dbm file broken
Message-Id: <BZ1V3.48914$23.1863405@typ11.nn.bcandid.com>

In article <7vu1fu$jb7$1@news.worldonline.nl>,
jeroen dijkmeijer <jdijkmei@dds.nl> wrote:
>We were running an application which used the DBM file functionality
>together whith dbmopen, this has always worked fine. But lately things have
>changed the production computer changed and the System Manager convinced me
>that nothing changed except for the hardware.

If really nothing changed except for the hardware, then your new
hardware is broken or buggy or both.  But maybe the OS or perl got
changed?

-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 6 Nov 1999 12:19:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: DBM files.... HELP
Message-Id: <8016bm$aa1$1@gellyfish.btinternet.com>

On Fri, 5 Nov 1999 23:57:34 +1100 muz1 wrote:
> 
> Question: can I create a dbm file on request and then shove all of the info
> from a form into it. It seems like everything I have read so far states that
> there has to be something there first like a dat file???????
> 

There is no reason that you shouldnt be able to create a new dbm file
except for the permissions of the directory of the place that you are
trying to create it and this is obviously not a Perl problem.  It might
help us if you were more specific about what actual problems you are
having.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 05 Nov 1999 15:35:04 -0800
From: "F. Heremans" <FH16@le.ac.uk>
Subject: Downloading files
Message-Id: <382369A8.5025@le.ac.uk>

Hello all,

Can somebody help me on this problem:
I want to make a HTML-page where I can fill in an internet-address (http
or ftp) and send it to the script. The script should download the file
and save it in the default directory (where it's running from).

Please send replies to : fh16@le.ac.uk

Thanx a lot!

C-Ya,
Filip


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

Date: Fri, 5 Nov 1999 08:50:39 -0800
From: Bill Moseley <moseley@best.com>
Subject: Re: Downloading files
Message-Id: <MPG.128caabcb8d8380b98984c@nntp1.ba.best.com>

F. Heremans (FH16@le.ac.uk) seems to say...
> Can somebody help me on this problem:
> I want to make a HTML-page where I can fill in an internet-address (http
> or ftp) and send it to the script.

perldoc CGI

> The script should download the file
> and save it in the default directory (where it's running from).

perldoc LWP
perldoc LWPCook
Perldoc LWP::UserAgent

> Please send replies to : fh16@le.ac.uk

Sorry, my ISP doesn't provided non-domestic email.



-- 
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.


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

Date: 5 Nov 1999 16:58:15 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Downloading files
Message-Id: <38230ca7_2@newsread3.dircon.co.uk>

F. Heremans <FH16@le.ac.uk> wrote:
> 
> Can somebody help me on this problem:
> I want to make a HTML-page where I can fill in an internet-address (http
> or ftp) and send it to the script. The script should download the file
> and save it in the default directory (where it's running from).
> 

use LWP::UserAgent;


/J\
-- 
"People say money brings its own problems. Rubbish, rubbish - I'm loaded -
it's fantastic" -


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

Date: Mon, 08 Nov 1999 11:40:02 GMT
From: martingormley@my-deja.com
Subject: downloading pdf file with correct name
Message-Id: <806cqi$pev$1@nnrp1.deja.com>

I am opening a script called download.cgi.
The script opens a socket which downloads a pdf file.

Is there anyway that I can get the script to download the pdf without
calling it download.pdf


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


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

Date: Fri, 05 Nov 1999 14:03:40 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: duplicates in an array
Message-Id: <3823543C.115839FD@mail.cor.epa.gov>

Baris Sumengen wrote:
> 
> Yes, you are right. Everybody has to go over all the FAQ's once before
> posting here.

Yes.  Thank you.  It doesn't hurt to at least scan the subjects 
covered, so you know whether there is already an answer you 
don't have to wait and wait for.

> But there is also another issue. I honestly sometimes don't understand the
> solution in the FAQ's. (I obviously don't know all the perl basics). But the
> idea behind perl is: "You don't have to know everything, but youy can still
> write useful programs".

Yes.  It is perfectly legit to say:

"I read the FAQ on keeping your own module directory, but I
don't understand it.  I tried this code, and it failed with
this error message [code and error go here ].  What resources
should I look at next?  Can someone explain where I'm going
off-course?"

Something like this shows:
[1] that you did read the FAQ
[2] you did try some code
[3] you do know how to follow the guidelines of this newsgroup
[4] and hence you are deserving of help  :-)

Don't expect to grok the entirety of Perl in one go.  Perl
is *large* and has a lot of intricate pieces.  But this is
what makes it useful.  Learn as you go, and remember that
there is lots of on-line Perl documentation when you're
stuck.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 05 Nov 1999 19:41:29 GMT
From: rmore1@my-deja.com
Subject: Dynamic Configuration File
Message-Id: <7vvbt4$51g$1@nnrp1.deja.com>

I was wondering what is the best method for accessing a configuration
file ...

Option 1:
===========
use lib "$ENV{CONF_DIR}";
use MyConfig;  # this is a .pm file :)


Option 2:
===========
use vars qw ( %GLOBAL1 );
do "$ENV{CONF_DIR}/MyConfig.pl";


Option 3:
===========
use vars qw ( %GLOBAL1 );
require "$ENV{CONF_DIR}/MyConfig.pl";



Any others??

--
=============================
Richard More
http://www.richmore.com/


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


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

Date: Fri, 5 Nov 1999 13:13:32 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Dynamic Configuration File
Message-Id: <Pine.GSO.4.10.9911051313050.29670-100000@user2.teleport.com>

On Fri, 5 Nov 1999 rmore1@my-deja.com wrote:

> I was wondering what is the best method for accessing a configuration
> file ...

Define "best". What's best for me may not be best for you, and there's no
point in any of us wasting our time until you can say just what you want.
 
You may need to choose among fastest, most memory efficient, easiest to
program, fewest lines of code, most robust, most portable, easiest to
debug, easiest to maintain, most like your other favorite programming
languages, or perhaps you mean some other criterion. (Of course, one
solution may fall into more than one of these categories.)
 
Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 6 Nov 1999 11:50:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Dynamic Configuration File
Message-Id: <8014l9$a4t$1@gellyfish.btinternet.com>

On Fri, 05 Nov 1999 19:41:29 GMT rmore1@my-deja.com wrote:
> I was wondering what is the best method for accessing a configuration
> file ...
> 
> Option 1:
> ===========
> use lib "$ENV{CONF_DIR}";
> use MyConfig;  # this is a .pm file :)
> 

<snip>

These methods all assume that you want to store your configuration in
the form of perl source code.  You might find it more convenient to
use some other format.  If you go to CPAN you will find quite a few
modules that deal with configuration files.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 5 Nov 1999 17:56:15 GMT
From: Howard Schultens <howard@neuro-physiol.med.uni-goettingen.de>
Subject: Re: efficient diff algorithm
Message-Id: <7vv5nv$1kp0$1@gwdu67.gwdg.de>

Greg McCarroll <greg@mccarroll.demon.co.uk> wrote:
> if you read the documentation of Algorithm::Diff it explains why it is
> so complicated, it depends on your exact application if there is a
> simpler one. If you want to describe exactly what you want I might be
> able to provide another option,

> Greg


I'm still a perl newbie, but is the documentation out of synch with
the code in the Diff module? The documentation says the call is:


  traverse_sequences(\@seq1, \@seq2,
                     { MATCH => $callback,
                       DISCARD_A => $callback,
                       DISCARD_B => $callback,
                     },
                     $comparison_function);


And the code in the distribution kit,
Algorithm-Diff-0.59/Algorithm/Diff.pm has

  sub traverse_sequences {
    my $dispatcher = shift;
    my $a = shift;
    my $b = shift;
    my $equal = shift;
    my $x = LCS_matrix($a, $b, $equal);

    my ($al, $bl) = (scalar(@$x)-1, scalar(@{$x->[0]})-1);
    my ($ap, $bp) = ($al, $bl);
    my $dispf;
    while (1) {
      $dispf = undef;
      my ($ai, $bi) = ($al-$ap, $bl-$bp);
      if ($ap == 0) {
	$dispf = $dispatcher->{A_FINISHED} || $dispatcher->{DISCARD_B};
	$bp--;                    # Where to put this?
      } elsif ($bp == 0) {
	$dispf = $dispatcher->{B_FINISHED} || $dispatcher->{DISCARD_A};

    .....

(that's enough to answer my question)

'my $dispatcher' gets the FIRST argument, then come $a and $b, etc?
I can't get it to work as stated in the documentation.

Thanks for info,

 ..Howard


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

Date: Mon, 08 Nov 1999 16:02:56 GMT
From: Mark Lofdahl <mel@disc.com>
To: greg@mccarroll.demon.co.uk
Subject: Re: efficient diff algorithm
Message-Id: <806s7d$4pt$1@nnrp1.deja.com>

In article <38180317.6935460@newspull.london1.eu.level3.net>,
  greg@mccarroll.demon.co.uk wrote:

> if you read the documentation of Algorithm::Diff it explains why it is
> so complicated, it depends on your exact application if there is a
> simpler one. If you want to describe exactly what you want I might be
> able to provide another option,
>
> Greg


Here's my situation. What I need to do is find the differences between
chunks of two files. Sometimes these chunks will be 2 lines, sometimes
they will be several hundred lines. My perl program does a lot of
preprocessing on the files, to eliminate things that would show up as
differences but that I don't want to show up. I like the way unix diff
works, and the output it produces, but I need to be able to diff just
chunks, instead of entire files. I tried Algorithm::Diff, but it seemed
quite slow, and took quite a bit of memory in some cases. Any ideas on
a better way to do this?

Mark


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


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

Date: Fri, 5 Nov 1999 16:08:59 GMT
From: see_URL_in.sig@end.to_mail_to.us (R L Samuell)
Subject: exemplify Perl
Message-Id: <1999.308.58139.309@205.198.93.196>

Several years ago, I developed a set of teaching  examples covering 180
Perl  topics  which I  used  to  supplement  work  and  instruction  in
three-day Perl  courses  I  taught.   Some  of  the  examples  actually
illustrate the specified topics while others for completeness  sake are
just  informational.  A few examples  have been  disabled,  modified or 
are unavailable because they required  user interaction of some sort in
their original non-HTML format.

Some course attendees found the examples helpful while others  did not.
I  offer them  now on the Web with the  hope that they may be a helpful
resource for some others outside the course context.

        http://samuell.lex.bluegrass.net/Services/exPerl.shtml

Please be very patient if you try to access  this site.   The server is
*QUITE*  slow  at times.  Hopefully,  this will  improve  as  equipment
upgrades are under way.

Regards,


R L Samuell
--
       Web: http://samuell.lex.bluegrass.net/
     Email: http://samuell.lex.bluegrass.net/mailto
    ObPerl: perl -e "use Pod::Text; &pod2text(shift);" # print POD to text
 Copyright: (c) 1999 R L Samuell, All Rights Reserved.




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

Date: Fri, 05 Nov 1999 14:49:48 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: exemplify Perl
Message-Id: <38235F0C.B27D058F@mail.cor.epa.gov>

R L Samuell wrote:
[snip]
>         http://samuell.lex.bluegrass.net/Services/exPerl.shtml

Lots of simple examples for the novice [along with the outputs,
for clarity].  But there are a few errors and elisions scattered
through the documents.  Nothing that couldn't be cleaned up with
a little constructive criticism.

And this group is soooo good at that.  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Mon, 8 Nov 1999 09:18:46 +0100
From: "Felix Maurer" <maurerf@post.ch>
Subject: expect module
Message-Id: <38268778@hcwe67>

Hi all,

I'm trying to use the expect module for the first time, and have some
problems with the following loop:

#!/usr/local/bin/perl
use Expect;
@disk = "/dev/dsk/c0t8d0s0","/dev/dsk/c0t8d0s6","/dev/dsk/c0t8d0s7";

# Start the newfs process.
foreach $disk (@disk) {
  ($newfs = Expect->spawn("newfs $disk")) || die "Couldn't spawn newfs, $!";

  unless ($newfs->expect(30,"(y/n)? ")) {
    die "Never got the confirmation prompt, ".$newfs->exp_error()."\n";
  }
  print $newfs "y\r";

  $newfs->soft_close();
}
__END__


First, it works only over one disk, and then i don't anderstand why I need
the soft_close command?

These are of course newbbie questions, but is there someone out there to
give me some hints?

Felix




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

Date: 6 Nov 1999 21:41:52 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Extract string
Message-Id: <8027b0$bp4$1@gellyfish.btinternet.com>

On Wed, 03 Nov 1999 16:01:46 -0800 David Cassell wrote:
> Kragen Sitaker wrote:
>> 
>> In article <381E5793.C249CE1E@inprise.com>,
>> Adrian Chin  <Achin@inprise.com> wrote:
>> >
>> >in a file call file.txt.  How do I extract the colored string out to a
>> >variable in per
>> 
>> Which string is colored?  And what is "per"?
> 
> Oh, so you're colorblind too.  You and Larry should really
> have that checked.  :-)
> 

Nah its just we get smething like this:

X-Conversion-Note: multipart/alternative contents have been removed.
        To get the whole article, turn alternative_handling OFF

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 6 Nov 1999 16:07:27 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: FAQ 3.9: Is there an IDE or Windows Perl Editor?
Message-Id: <801jnv$b1v$1@gellyfish.btinternet.com>

On Fri, 05 Nov 1999 03:36:46 -0800 Tim Westlake wrote:
> In article <382214EF.393C6093@mail.cor.epa.gov>, David Cassell
> <cassell@mail.cor.epa.gov> wrote:
>> Tim, surely you've noticed that Perl attracts people who have
>> written code in lots of weird little languages.  People like
>> Jonathan know about this.  And lots of editors on the page
>> Jonathan cited will let you do this.  Some of them [like emacs]
>> already have support for tons of obscure languages and 4GLs.
>
>   no issue with that, I was simply offering up a reasonable and valid
> answer to a question. Jonathan just didnt seem to appreciate this - I
> mean, its not like have any personal or commercial interest in the Zeus
> editor.
> 

Except the only reasonable and valid answer in *this newsgroup* is a
reference to a FAQ or the page that I referred: otherwise we end up in
another pointless thread of editor advocacy which is always the result
of any talk of editors.  If you feel that your favourite editor needs
some exposure then you ought to contact the maintainer of that page.

That is <http://www.perl.com/reference/query.cgi?editors> for those that
have a short usenet memory.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 05 Nov 1999 13:46:26 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
To: Tom and Gnat <perlfaq-suggestions@perl.com>
Subject: Re: FAQ 4.28: How do I capitalize all the words on one line?
Message-Id: <38235032.F8BCF9D6@mail.cor.epa.gov>

[emailed to perlfaq-suggestions also]

Tom Christiansen wrote:
[snip]
>   How do I capitalize all the words on one line?
> 
>     To make the first letter of each word upper case:
> 
>             $line =~ s/\b(\w)/\U$1/g;
> 
>     This has the strange effect of turning "`don't do it'" into "`Don'T
>     Do It'". Sometimes you might want this, instead (Suggested by Brian
>     Foy):
[snip]

Umm, given the particular preferences of brian d foy for the
spelling and capitalization of his name, don't you think this 
answer is rather ironic?

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 05 Nov 1999 17:36:39 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
To: Tom and Gnat <perlfaq-suggestions@perl.com>
Subject: Re: FAQ 4.33: How do I find the soundex value of a string?
Message-Id: <38238627.45979957@mail.cor.epa.gov>

[copy to perlfaq-suggestions]

Tom Christiansen wrote:
[snip]
>   How do I find the soundex value of a string?
> 
>     Use the standard Text::Soundex module distributed with perl. But
>     before you do so, you may want to determine whether `soundex' is in
>     fact what you think it is. Knuth's soundex algorithm compresses
>     words into a small space, and so it does not necessarily
>     distinguish between two words which you might want to appear
>     separately. For example, the last names `Knuth' and `Kant' are both
>     mapped to the soundex code K530. If Text::Soundex does not do what
>     you are looking for, you might want to consider the String::Approx
>     module available at CPAN.

      This module implements Knuth's version of soundex, which
      is not the original version of Margaret K. Odell and Robert
      C. Russel (US Patents 1261167 (1918) and 1435663 (1922) ).
      Knuth's algorithm adds trailing zeroes when needed, and also
      truncates the result to four characters.


And now for something completely different: a bit of annoying 
whingeing [?as opposed to my usual posts?].

Since I wrote the bottom 2/3 of the indented text, is it reasonable 
to credit me?

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 05 Nov 1999 17:29:14 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
To: Tom and Gnat <perlfaq-suggestions@perl.com>
Subject: Re: FAQ 4.36: Why don't my E<lt>E<lt>HERE documents work?
Message-Id: <3823846A.5C89FC7B@mail.cor.epa.gov>

[copy to perlfaq-suggestions]

Tom Christiansen wrote:
[snip]
>   Why don't my <<HERE documents work?
> 
>     Check for these three things:

 ...three...  No, four!
 
>     1. There must be no space after the << part.
>     2. There (probably) should be a semicolon at the end.
>     3. You can't (easily) have any space in front of the tag.

      4. On win32 systems, you cannot have the tag on the last
      line of the program - add another line afterward.
[big snip]

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Sun, 07 Nov 1999 10:14:06 GMT
From: Samuel Kilchenmann <skilchen@swissonline.ch>
Subject: Re: FAQ 4.49: How do I permute N elements of a list?
Message-Id: <803jde$ub4$1@nnrp1.deja.com>

In article <3825260f@cs.colorado.edu>,
  perlfaq-suggestions@perl.com (Tom and Gnat) wrote:
> (This excerpt from perlfaq4 - Data Manipulation
>
> How do I permute N elements of a list?
>
IMHO this question does not match the answer.

>  Here's a little program that generates all permutations of all the
>  words on each line of input. The algorithm embodied in the
>  permute() function should work on any list:
>
>  #!/usr/bin/perl -n
>  # tsc-permute: permute each word of input
>  permute([split], []);
>  sub permute {
>      my @items = @{ $_[0] };
>      my @perms = @{ $_[1] };
>      unless (@items) {
>          print "@perms\n";
>      } else {
>          my(@newitems,@newperms,$i);
>              foreach $i (0 .. $#items) {
>              @newitems = @items;
>              @newperms = @perms;
>              unshift(@newperms, splice(@newitems, $i, 1));

Why unshift instead of push, which would give you the permutations in
lexicographical order. Is unshift more efficient than push?

>              permute([@newitems], [@newperms]);

Why not:
               permute(\@newitems, \@newperms);

You don't need to create anonymous copies of the arrays here.

>          }
>      }
>  }
>

Is there a Perl module which implements more of this kind of
combinatorial algorithms?


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


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

Date: Mon, 08 Nov 1999 10:35:39 -0500
From: dwilgaREMOVE@mtholyoke.edu (Dan Wilga)
Subject: Re: FAQ 4.55: How do I look up a hash element by value?
Message-Id: <dwilgaREMOVE-0811991035390001@wilga.mtholyoke.edu>

In article <3825f94e@cs.colorado.edu>, perlfaq-suggestions@perl.com (Tom
and Gnat) wrote:

>   How do I look up a hash element by value?
> 
>     Create a reverse hash:
> 
>         %by_value = reverse %by_key;
>         $key = $by_value{$value};
> 
>     That's not particularly efficient. It would be more space-efficient
>     to use:
> 
>         while (($key, $value) = each %by_key) {
>             $by_value{$value} = $key;
>         }

Why is the second method more space-efficient? Doesn't it require the same
amount of space (the original %by_key plus the final %by_value)? Or is it
that reverse creates a temporary hash before writing to %by_value? It's
not clear from perlfunc if this is the case.

I don't doubt that you're right, I just want to understand why.

And would the second version be much slower?

Dan Wilga          dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply  **


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

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


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