[9263] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2858 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 12 17:08:40 1998

Date: Fri, 12 Jun 98 14:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 12 Jun 1998     Volume: 8 Number: 2858

Today's topics:
    Re: [META] hypersensitivity (Greg Bacon)
    Re: [META] hypersensitivity (Jonathan Stowe)
    Re: [META] hypersensitivity (Tad McClellan)
    Re: ceil or trunc <tchrist@mox.perl.com>
    Re: Certified Perl Programmers <jdporter@min.net>
    Re: Certified Perl Programmers (Mark-Jason Dominus)
    Re: Command line substitution thru subdirectories (Jonathan Stowe)
    Re: Commercial use of perl. (Chris Nandor)
    Re: Commercial use of perl. <tkil@scrye.com>
    Re: diff-like utility in Perl? (Jonathan Stowe)
    Re: Handling of the ASCII behavior of ^M (Mark-Jason Dominus)
    Re: Have we got a good free Perl manual? (Kris Van Hees)
    Re: Have we got a good free Perl manual? (Todd Lehman)
    Re: Have we got a good free Perl manual? (Todd Lehman)
    Re: Have we got a good free Perl manual? <sbo@nortel.ca_NO_SPAM>
    Re: NEED PERL SCRIPTING (Andy Lester)
    Re: null value checking with numbers <jdporter@min.net>
    Re: pass the gravy and the hashref, please -- solved (Mark-Jason Dominus)
    Re: perl and recursion? <wentzel@umr.edu>
    Re: Prob in FAQ: Week of the year (Abigail)
    Re: Prob in FAQ: Week of the year <tchrist@mox.perl.com>
    Re: Puzzle challenge (Greg Bacon)
    Re: Puzzle challenge <jdporter@min.net>
    Re: Puzzle challenge (Mark-Jason Dominus)
    Re: Question about =~ <psdspss@execpc.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 12 Jun 1998 19:21:21 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: [META] hypersensitivity
Message-Id: <6lrv3h$q7g$2@info.uah.edu>

In article <m3ium753qk.fsf@windlord.stanford.edu>,
	Russ Allbery <rra@stanford.edu> writes:
: jimbo <jimbo@soundimages.co.uk> writes:
: > Even more disheartening is that Mr. Bacon is a moderator should a
: > moderated group become reality. I fear that Perl, if left to the likes
: > of Mr. Bacon, [. . .] 
: 
: The proposed newsgroup has quite a few more moderators than just
: Mr. Bacon, [. . .]

What's all this talk of Mr. Bacon?  I don't think either of my dad or my
grandfather are Perl hackers (they probably couldn't tell you what the
letters CFV stand for, and I know they're not listed as moderators).

I've always found Greg to be sufficient. :-)
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Fri, 12 Jun 1998 20:32:28 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: [META] hypersensitivity
Message-Id: <35817504.1608313@news.btinternet.com>

On 11 Jun 1998 19:22:00 -0700, Gary L. Burnore wrote :

>On 11 Jun 1998 18:37:59 GMT in article <6lp867$s25$1@csnews.cs.colorado.edu>, Tom Christiansen <tchrist@mox.perl.com> wrote:
>:  [courtesy cc of this posting sent to cited author via email]
>
<snip>

>: The problem, in a nutshell, is that whenever we point out a simple and
>: obvious--sometimes even elegant--solution, one which inevitably involves
>: gluing together other tools (which, I must point out, was what Perl
>: *designed* for), we get back nothing but flames from those who cannot
>: help themselves.  
>
>No, the problem in a nutshell is not answering a perl question by
>complaining about an os.  The problem in a nutshell is you.
>
Dont *we all* complain about an OS ? I know for sure that today I have
slagged off Windows 95 Windows NT VME Solaris.

The problem here is that some OS just dont support the tool box idea
and are are poorer environments for the developer than they would be
otherwise.

>If you don't want to answer a question because of the OS someone uses, the
>shut the fuck up and let someone else answer it.  How hard can that be?
>Clue: It's not hard, you'd just not have any fun at it.
>

But Tom did provide an answer albeit one that was not ideal for the
environment that the original poster finds himself in but nonetheless
an accurate and useful answer for anyone who happened to need a
solution to that same problem in an environment that could support the
solution that was given (?)

I for one would rather have Tom's solution rather than none or worse
boring ones - and hey this all spawned some rather ingenious and
amusing stuff from "other side".

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Thu, 11 Jun 1998 23:43:43 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: [META] hypersensitivity
Message-Id: <vlbql6.npj.ln@localhost>

Gary L. Burnore (gburnore@primenet.com) wrote:
: On 11 Jun 1998 20:40:51 GMT in article <6lpfcj$iju$1@info.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
: : jimbo@soundimages.co.uk writes:
: : : gbacon@cs.uah.edu (Greg Bacon) writes:
: : : > Have you stopped beating your wife?
: : : 
: : : The observation stands. Why all the anguish?

: : I got tired of the same old boring ``ad hominem attacks add nothing to
: : your position''.  Ad hominem looked really fun, and I wanted to give it
: : a whirl.

: Liar


Uh, what lie are you referring to?


1) he's not really tired?

2) "ad hominem attacks add nothing to your position" is exciting?

3) Ad hominem does add something to your position?

4) Ad hominem attacks do not look fun?

5) he did not want to give it a whirl?



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


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

Date: 12 Jun 1998 20:25:33 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ceil or trunc
Message-Id: <6ls2rt$feb$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Ala Qumsieh <aqumsieh@matrox.com> writes:
: I would use:
:$rounded_num = int ($num + 0.5);

Pity that that doesn't work very often.  First you forgot negatives:

    $x = -2.5;
    print int($x + 0.5);

Secondly, you're back to the same old FLOATS ARE NOT REAL NUMBERS problem.

Imagine taking 19/20, then adding 1/2 to it.  Now, round that:

  % printf "%.20f", (0.5 + (19/20) + 0.5)
  1.94999999999999995559

Guess what happens when you truncate that into an int?

I can't imagine why no one reads the FAQ.

--tom
-- 
Fifty years of programming language research, and we end up with C++ ???
                                    --Richard A. O'Keefe


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

Date: Fri, 12 Jun 1998 19:24:19 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Certified Perl Programmers
Message-Id: <358181D4.A34@min.net>

Danny Aldham wrote:
> 
> Does this Certification come with a snappy wall plaque? I really want
> a snappy wall plaque. With a picture of a Camel on it....

A couple weeks ago I got a call from a nice lady who said that I might
get a new Plymouth Voyager if I would go and listen to a 45-minute
presentation.  Well, at the end, they asked me if I was interested in
buying one of the time-share condos they were selling, and I said no.
I didn't get the car, either. But I did get a Perl certification.

John Porter


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

Date: 12 Jun 1998 16:11:43 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Certified Perl Programmers
Message-Id: <6ls21v$c1u$1@monet.op.net>


In article <6lolt0$coi$1@nnrp1.dejanews.com>,  <jduncan@hawk.igs.net> wrote:
>> I've been thinking that if some people need physical certificates, I
>> could print some up and supply them for a nominal fee, maybe $2. 
>
>   SASE's would do the trick,  then we could all put the certificate on our
>walls,  and be all official. Well, nearly....

Well, I don't think so.  If you're going to bother printing real
certificates, you might as well make them look good.  If they're going
to look good, they should be printed well, maybe embossed, have a bit
of ribbon attached, and then mailed with a carboard insert to prevent
postal mangling, etc.  I think two bucks is probably about right; I
wasn't just naming random numbers.

Otherwise you might as well make them available over the web and let
people print their own.


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

Date: Fri, 12 Jun 1998 20:32:26 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Command line substitution thru subdirectories
Message-Id: <35817188.716331@news.btinternet.com>

On 12 Jun 1998 00:40:18 GMT, Scratchie wrote :

>: As I said, porting the OS specific stuff is left as an exercise
>: to the reader - if you need help with that, ask in a group
>: that's specific to your OS. That falls beyond the scope of this
>: group.
>
>So your advice to perl beginners on the Wintel platform is that they write
>their own versions of any unix utility they need?
>
*My* advice is exactly that - the IBM AT I gave to my brother some
years ago had most of the things that I needed for my toolbox and when
I needed another tool I stole a C compiler and wrote another etc
etc....  Now of course if I have to work with some system that doesnt
have the tools that I need I can download them but hey ...

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Fri, 12 Jun 1998 19:01:01 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Commercial use of perl.
Message-Id: <pudge-1206981458160001@dynamic174.ply.adelphia.net>

In article <9Peg1.117$Fr5.1400983@cam-news-reader1.bbnplanet.com>,
mtiernan@bbn.com (Michael C. Tiernan) wrote:

#         I would suspect that legally, either one qualifies as
#         commercial use of perl and as such will require some further
#         discussions with SOMEONE.

Nah.  Perl is free.  Read the Artistic License, and/or the GNU license.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 12 Jun 1998 13:19:33 -0600
From: Tkil <tkil@scrye.com>
Subject: Re: Commercial use of perl.
Message-Id: <gbtryo2be.fsf@scrye.com>


[cc'd and posted.]

>>>>> "Michael" == Michael C Tiernan <mtiernan@bbn.com> writes:

Michael> Okay, say a company wanted to utilize perl in a product,
Michael> there's two possible scenarios that come to my mind:
Michael>
Michael> 1) Company A sells a product that uses perl but they don't
Michael>    supply it, that's up to the purchaser to get and install.
Michael>
Michael> 2) Company A sells a product that has perl bundled in it.

um... which part of the Artistic License seems confusing?

   http://language.perl.com/misc/Artistic.html

point 5 seems to cover (2) above:

   However, you may distribute this Package in aggregate with other
   (possibly commercial) programs as part of a larger (possibly
   commercial) software distribution provided that you do not
   advertise this Package as a product of your own.

in the first case, you're just using perl as an external tool.  i use
GPLed tools to build things that make my company money -- is that
"commercial use"?  sure.  is it against the gpl?  not so far as i
know.

you might also find this FAQ entry useful:

   http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#Where_can_I_buy_a_comercial_ver

Michael> I would suspect that legally, either one qualifies as comm-
Michael> ercial use of perl and as such will require some further
Michael> discussions with SOMEONE.

if you're paranoid about it, you talk to a good intellectual property
lawyer.  [which i am not.]

my personal view of it is this:  so long as you don't try to pass perl 
off as your own, you tell them where to get perl if they want it, and
you don't try to sell perl itself, you should be fine.  but see
previous comment about me not being a lawyer.

t.
--
Tkil * <URL: http://www.scrye.com/~tkil> * hopelessly hopeless romantic.
  "So amplify this little one 	|   She hears as much as she can see
   She's a volume freak       	|   And what she sees, she can't believe."
        -- Catherine Wheel, _Happy Days_, "Judy Staring At The Sun"


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

Date: Fri, 12 Jun 1998 20:32:30 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: diff-like utility in Perl?
Message-Id: <358188c7.6569579@news.btinternet.com>

On 12 Jun 1998 12:33:08 GMT, Joe Foose wrote :

>Does anybody know if there is a Perl function which compares two files or
>strings and returns output similar to Unix's diff command?
>

Why when we all have diff
<paste>
Microsoft(R) MS-DOS(R) Version 6.22
             (C)Copyright Microsoft Corp 1981-1994.

C:\>diff -v
diff - GNU diffutils 2.7.1

</paste>
seek and ye shall find.
(sorry Mac People I cant speak for you of course)

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 12 Jun 1998 16:56:19 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Handling of the ASCII behavior of ^M
Message-Id: <6ls4lj$ftu$1@monet.op.net>


In article <qylium79bvq.fsf@ubu.enst.fr>,
Akim Demaille  <demaille@inf.enst.fr> wrote:
>I wanted to write a small snippet that handles ^M by
>going back to the beginning of the line, and superimposing
>the next line on it.
>
>I fell down to this:
>
> [Mess]
>Has somebody got a better idea?

while (<>) {
  chomp;
  my @sublines = split /\cM/, $_;
  my $out_line = shift @sublines;
  while (@sublines) {
    my $next_subline = shift @sublines;
    substr($out_line, 0, length $next_subline) = $next_subline;
  }
  print $out_line, "\n";
}

I guess if this program has a key point, it's the `substr' line.  But
the real success here is because the control flow in the program
matches the structure of the input.

Thanks for making your question so clear.  When I saw your subject
line, I was expecting not to be able to make sense of what you wanted,
but when I read the article I was pleasantly surprised.


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

Date: 12 Jun 1998 19:43:53 GMT
From: aedil@fnx.com (Kris Van Hees)
Subject: Re: Have we got a good free Perl manual?
Message-Id: <6ls0dp$qca$1@client2.news.psi.net>

On 12 Jun at 17:12:18, Barry Margolin wrote <Sjdg1.114$Fr5.1316181@cam-news-reader1.bbnplanet.com> which contained:
> That's precisely what RMS is asking for.  This whole discussion is about an
> item on the GNU Project task list that says something like "Someone should
> write a good, free manual for Perl."  He never claims there's something
> wrong with Perl because its documentation isn't free, he's just asking for
> volunteers to provide what he sees as a missing feature.

Possibly a missing feature, though I don't think it's something to pin on
Perl for now, since as I said, the software the FSF is providing is quite
lacking decent documentation aswell, and perhaps that should get the most
immediate focus rather than a package such as Perl, which definitely isn't
less documented (as far as free documentation goes) than most FSF provided
software.
> 
> Of course, if you make your documentation free in the first place, you're
> helping the free software community more, since it's one less thing that
> has to be reinvented.  In RMS's mind, anyone who creates non-free software
> or documentation is hurting the free software community.  And it seems
> inconsistent to write free software but then provide only non-free
> documentation; it puts up a large barrier against modification of the
> software (a small change to the software could require you to recreate all
> of the documentation from scratch, just so you can document the change
> properly).  Morally, making it difficult for someone to modify the code is
> almost as bad as prohibiting it outright.

I should have been more specific.  I envision more a situation where the
actual software is free software, and gets distributed with documentation.
But the really nice documentation, with in-depth discussions etc could be
non-free for the very reason that some people are trying to earn a living
by writing books.

Now, it would indeed be wonderful if the world would work in a true free
spirit (as perhaps RMS would prefer), but unfortunately that will not be
happening anytime soon.  People have to make a living, and publishers are
not likely to allow free copying of books they publish, because then alot
of people would simply never buy the book...

If I have to make a choice between free software and free documentation,
I'd take free software at all times.  If someone wants free software and
free documentation, well...  one is free to write one's own :)

Aedil


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

Date: Fri, 12 Jun 1998 20:20:41 GMT
From: lehman@visi.com (Todd Lehman)
Subject: Re: Have we got a good free Perl manual?
Message-Id: <t4gg1.1032$bj2.4707888@ptah.visi.com>

David Kastrup <dak@mailhost.neuroinformatik.ruhr-uni-bochum.de> writes:
> If you are learning the language for pleasure, you might want to
> acquire non-free books.  If you want to learn the language in order to
> use it for programming free software, the non-existence of good free
> documentation will block a lot of possible contributors from helping.
> That's not what free software is about.  Do you have an idea how
> expensive a "cheap" American book comes, for example, to an average
> former Soviet programmer?

No, I don't, and you have a good point regardless.


> > > It wasn't the
> > > first time and (to our community's great loss) it was far from the
> > > last.
> > 
> > It was their choice.  To suggest that it was a loss to the community is
> > to say that they were under some cosmic obligation to contribute free
> > documentation for the free software they created.  
>
> This is nonsense.  It is a loss to the community period.  If they were
> under some cosmic obligation, the community would not encounter any
> loss because it could sue them for providing the stuff.  As they are
> not under an obligation, it is a loss to the community for good.

Aren't you confusing loss with non-gain?  Was the documentation sold
to O'Reilly once freely available?  If so, then you could consider it a
loss.  If not, then to call it a loss is to presume that it would have
and should have been contributed to the community all along, and that is
up to the authors and -no one- else.


> For that reason, RMS has put good free books about Perl on the task
> list.  He has not put any demands on anybody to take this up.  He has
> been flamed beyond sanity and called all sorts of names like "liar",
> "hypocrite", "evil", "Bill Gates of free software" and whatever,
> however, for *daring* to put something like that on the task list.

I think it's a great thing to have on a list and I can't understand why
anyone would think it's bad.  I have all the ORA Perl books and was very
happy to buy them, but more good documentation of any type (free or not)
would make me even more happy.

My stink with RMS's post was the underlying tone and the borderline
haughtiness.


> > I would argue that the O'Reilly Perl books and TPJ are in fact very much a
> > part of the free software community (w.r.t. Perl) as they document a piece
> > of free software.
>
> They are not part of the free software community because nothing free
> ever comes back from them.  Documentation by them is as much part of
> the free software community as dandruff is part of my body: initially
> very close, it nevertheless does not contribute anything to any living
> cells of me and will eventually in its unchanged state fall off.  It
> is associated to free software, but is not part of the community.

OK, a words thing then.  I'll agree to disagree on that one.  In my mind,
anything that is "associated to" free software is "part of" the free
software community, or "adjacent to" or "plays an important role in."
I didn't understand that there was such a strict definition of "part of"
w.r.t. free software.


> > Does not the free software community extend far beyond
> > the simple set of things which are free?
>
> Nope.  Free software community is the people working on free
> software.  A bar is not part of the mining industry even when it keeps
> alive by being visited by miners.

OK.  Thanks for the clarification.  In that case, then WTF is RMS to
criticise ORA for not contributing to the FSC?  Maybe I totally mis-
interpreted the tone of RMS's post, but he seemed bitter.

--Todd


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

Date: Fri, 12 Jun 1998 20:33:45 GMT
From: lehman@visi.com (Todd Lehman)
Subject: Re: Have we got a good free Perl manual?
Message-Id: <Jggg1.1034$bj2.4715517@ptah.visi.com>

Barry Margolin <barmar@bbnplanet.com> writes:
> Todd Lehman <lehman@visi.com> wrote:
> > 
> > rms@gnu.org (Richard Stallman) writes:
> > > Once upon a time, I thought I would learn Perl.  I got a copy of a
> > > free manual, but I found it simply unreadable, and gave up.  Perl
> > > users told me that there were better manuals, but they were not free.
> > 
> > It seems odd to deny oneself the pleasure of learning a new language for
> > several years simply because someone tells you that the best documentation
> > isn't freely available.
> > 
> > Was the decision a personal monetary issue or a moral issue?
> > 
> > For serious work, a Perl library of about 10 good titles costs around $300.
> > But you can get started for a small investment of $30 or $40, depending on
> > which book you choose.  Alternatively, perhaps a friend or relative could
> > buy you _Programming_Perl_ or _Learning_Perl_ as a gift.
> 
> What does money have to do with this discussion?  If you've read this
> thread, you should know that when RMS says "free" he refers to freedom to
> share and modify, not price.

I wasn't 100% sure.  I did dig up the entire thread in DejaNews and read
every follow-up before posting, but I still wasn't sure.  Boggles my mind.
But it is his choice.


> For RMS, it's clearly a moral issue.  He considers himself a vanguard of
> the free software movement, and insists on using free software as much as
> feasible.  When he needs software for a task and can't find a free version,
> he writes it himself or encourages others to do so.

I admire that.  What I don't admire is pissing on ORA and on Perl book
authors because they don't share 100% of his vision.

--Todd


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

Date: 12 Jun 1998 16:13:33 -0400
From: Stephane Boucher <sbo@nortel.ca_NO_SPAM>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <9xoemwunzte.fsf@bcarsf26.dpn>

Tom Christiansen <tchrist@mox.perl.com> writes:

> aedil@fnx.com (Kris Van Hees) writes:
> :Anyhow...  What I wonder about is why I can't find a decent GCC manual, free
> :or not free.  

The reason you can't find it is that it hasn't been written yet.
 
> Funny, eh?  

I can believe it is funny for you. It is certainly easier for you to
say that it is funny than go look at the FSF web page to find out
whether there is a work item for a GCC manual and a C manual. I'm
surprised you did not notice it, since it is in the same task list as
a free manual for Perl. It is funny that you ask people to read
between the lines. The first thing I'd recommend you do is read the
lines themselves first before trying to read between the lines...

>From the GNU web page:
------------------------------------------------------------
Documentation

We very urgently need documentation for some parts of the system that
already exist.

       A C reference manual. (RMS made a try at one, which you could
	start with).
       A manual for Ghostscript. 
       A manual for TCSH. 
       A good free manual for Perl. (There are proprietary books, but
	these are no good, because they are being withheld from our
	community by their owners.) 
       A manual for PIC (the graphics formatting language). 
       A book on how GCC works and why various machine descriptions
        are written as they are. 
       A manual for programming X-window applications. 
       Manuals for various X window managers. 
       Reference cards for those manuals that don't have them: C
        Compiler, Make, Texinfo, Termcap, and maybe the C Library.
       Many utilities need documentation, including grep and others. 
------------------------------------------------------------
 
> I don't imagine you're referring to that terrible habit of sending out
> cruddy manpages, ones that say they're intentionally wrong?

Ok Tom, let us have it. I can feel it coming. Give us your:
	"Info sucks. Long live man pages."

We want that speech now!
-- 
  ,
Stephane Boucher, ing          sbo@nortel.ca
- NORTEL -                     Tel: (613)763-9778
Bell-Northern Research / Recherches Bell-Northern


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

Date: 12 Jun 1998 20:25:22 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: NEED PERL SCRIPTING
Message-Id: <6ls2ri$1j3$1@usenet11.supernews.com>

: I have to agree, lord knows I could use a workout, but it
: doesn't put bread on the table. I think you'll have to up
: your offer to generate any interest.

Maybe if you didn't have so much bread on your table, you wouldn't need
the workout, n'cest pas?

xoxo,
Andy


--
-- 
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: Fri, 12 Jun 1998 19:56:16 GMT
From: John Porter <jdporter@min.net>
Subject: Re: null value checking with numbers
Message-Id: <35818952.48FF@min.net>

Irene Barg wrote:
> 
> if ($value eq "ERR") {
>     print "Error:  rel focus = $value\n";
>     exit(-1);
> }

How about:

	$value ne 'ERR' or die "Error: rel focus = $value";

I guess that won't work if you need the exit status to be -1...


> if ($value == "") {

Typo, right?  Should be eq, not ==.

John Porter


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

Date: 12 Jun 1998 16:22:52 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: pass the gravy and the hashref, please -- solved
Message-Id: <6ls2ms$cfa$1@monet.op.net>
Keywords: Bloomfield freeing nut quipping


In article <3581527F.5CE9843C@umbc.edu>,
Scott Englehart  <sengle1@umbc.edu> wrote:
>Why does this work:
>
>    foreach $key (@keys){
>        print $this->{'stopped_content'}->{$key};
>        }
>
>But this:
>
>    while ( ($k, $v) = each $this->{'stopped_content'}->{} ){
>        print       $v;
>       }
>does not run:

Is this a trick question?  Because one is syntactically correct, and
one isn't.

`each' only applies to a hash.  $this->{'stopped_content'} is a
reference to a hash.  If you have a reference to a hash, and you want
the hash it refers to, you must do %{REF}.  That is the only way to do
it.  If you have a reference to a hash, and you want to `each' on the
hash, you must do  `each %{REF}'.  Nothing else will work.  In this
case, TIOOWDTI.  (There Is Only One Way To Do It.)

Try this:
    while ( ($k, $v) = each %{$this->{'stopped_content'}} ){
        print       $v;
       }

REF->{} doesn't do it, and in fact doesn't mean anything at all, and
never has. There was some discussion on perl5-porters recently about
making it synonymous with %{REF}, but it isn't part of the language
yet, and maybe never.

The next issue of The Perl Journal is going to have a very nice
article that explains everything you need to know about references in
three simple pages.  You might want to watch for it; it should be out
in a few weeks.



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

Date: 12 Jun 98 18:52:01 GMT
From: Michael Wentzel <wentzel@umr.edu>
Subject: Re: perl and recursion?
Message-Id: <358178d1.0@news.cc.umr.edu>

Craig Berry <cberry@cinenet.net> wrote:
: Why not just try it?  (But yes, it does.  Be careful to make proper use of
: 'my' and/or 'local' to get proper scoping for variables used in the
: subroutine.)

Well, the only machine I have perl running on is building a new 
kernel...Day1(major problems with current kernel and new hardware) so for 
all intents and purposes it is down right now and I was bored so I 
thought I'd ask since I was having trouble finding it documented...(and 
I never exec a script without first perl -w 'ing it first due to bad  
experiences).  I just figured if no one followuped I would just figure it 
out through trial and error when I get my box back up and running.  Thanks 
for the response though.


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

Date: 12 Jun 1998 19:55:02 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Prob in FAQ: Week of the year
Message-Id: <6ls12m$5ou$1@client3.news.psi.net>

Nicholas Carey (ncarey@harlequin.com) wrote on MDCCXLVI September
MCMXCIII in <URL: news:MPG.feaf735eea90f33989682@newshost>:
++ In article <6lppul$ma4$8@csnews.cs.colorado.edu>, 
++ tchrist@mox.perl.com says...
++ 
++ > Keep in mind that last time I checked, American work weeks did not
++ > follow that.  Perhaps this has changed.  I got out of the work business
++ > long ago. :-)
++ 
++ As far as I know, there are two conflicting ways of determining 
++ the first 'work' week of the year:
++ 
++   * the pragmatic way:
++     the week containing the 1st Monday of that calendar year.
++ 
++   * the ISO way, in which
++     * 'Week' is defined as Monday-Sunday
++     * The first week of a calendar year is the first week
++       containing four (4) days -- this has the implication
++       of allowing the calendar year to begin as early as
++       December 29th of the previous calendar year and
++       as late as January 4th. In other words, the first week
++       of the ISO year is that Monday-Sunday period containing
++       the first Thursday of the calendar year.

So, with the pragmatic way, the first week can start as late
as Jan 7, which is somehow better than Jan 4? 

Given that 7 doesn't divide 365, so you always end up with
weeks not beginning and/or ending on year boundaries, the
only silly thing to do is to ignore a standard.



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 12 Jun 1998 20:32:50 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Prob in FAQ: Week of the year
Message-Id: <6ls39i$feb$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    abigail@fnx.com writes:
:Given that 7 doesn't divide 365, so you always end up with
:weeks not beginning and/or ending on year boundaries, the
:only silly thing to do is to ignore a standard.

Welcome to America, where Common Law and established practice are 
far more important than Napoleonic Codes.  :)

--tom
-- 
"A well-written program is its own heaven;
a poorly-written program is its own hell."


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

Date: 12 Jun 1998 19:38:24 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Puzzle challenge
Message-Id: <6ls03g$q7g$3@info.uah.edu>

In article <EuG1os.J04@ig.co.uk>,
	Tim.Bunce@ig.co.uk (Tim Bunce) (Tim Bunce) writes:
: The problem is that the messengers quite often, say 70%, miss out one
: or more names and occasionally, say 10%, get the order wrong.

What if they all forget the same name?  Doesn't the fact that this is
possible make it impossible to recover the original list in all cases?

Greg 
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Fri, 12 Jun 1998 19:51:07 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Puzzle challenge
Message-Id: <3581881C.5C7E@min.net>

Tim Bunce Tim Bunce wrote:
> 
> Names are never added, repeated or changed...

Hmmm, you violated your own rules.  :-)

John Porter


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

Date: 12 Jun 1998 16:43:59 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Puzzle challenge
Message-Id: <6ls3uf$dcd$1@monet.op.net>

In article <EuG1os.J04@ig.co.uk>,
Tim Bunce) (Tim Bunce <Tim.Bunce@ig.co.uk> wrote:
>The messengers travel independently to a destination were they
>give the names to you.
>
>The problem is that the messengers quite often, say 70%, miss out one
>or more names and occasionally, say 10%, get the order wrong.
>The problem is to find the full list of names and the original order.

I think you need to be more specific here, because the best obvious
solution is to send a lot of messengers, and I suppose you don't want
that.

If you send a hundred messengers, then about 27 will arrive with the
original correct list, and the other 73 will arrive with various
mangled lists. So you look through the different versions, find the
one that predominates, and the likelihood is that it is correct.

In any event, there's no solution that's guaranteed to solve the
problem in all cases, because no matter how many messangers there are,
they might all garble the list in the same way, and you'd never be
able to tell the difference.  

To make this into a well-specified problem, you need to say at least
two more things: how any messengers are allowed, and what likelihood
of failure is tolerable.





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

Date: Fri, 12 Jun 1998 14:30:03 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: Question about =~
Message-Id: <358181BB.95488839@execpc.com>



Keppy Boone wrote:

> I am having some difficulty getting a search to work given a string.
>
> ex.
>
> $_ =~ /look/i;    # works fine.
>
> $search = "/look/i";
> $_ =~ $search;    #Doesn't work.
>
> Any Ideas will help.
> Please email me at ccboone@amber.indstate.edu
>
> Charles Boone

  Is it not something similar to this
$x = 5;
$y = 5;

if ($x == $y ) # Works !!!!

but now
$x = 5
$y = "==5"

if ($x $y) # Croaks (:-(

so, if you want to search for look

$search = "look";

$_ =~ /$search/i; # Works.

Hope that helps.

Hope that helps.

Deva



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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 2858
**************************************

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