[18086] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 246 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 8 14:20:55 2001

Date: Thu, 8 Feb 2001 11:20:38 -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: <981660037-v10-i246@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 8 Feb 2001     Volume: 10 Number: 246

Today's topics:
    Re: splitting a string on the / character jstanley@mmm.com
    Re: splitting a string on the / character (Randal L. Schwartz)
    Re: This is driving me nuts and I need a guru (Peter L. Berghold)
    Re: This is driving me nuts and I need a guru (Randal L. Schwartz)
    Re: Validating date formats <sshewmaker@transy.edu>
    Re: Validating date formats nobull@mail.com
    Re: When is an array @f allowed in a string? (Mark Jason Dominus)
    Re: When is an array @f allowed in a string? aramis1631@my-deja.com
    Re: When is an array @f allowed in a string? (Philip Hirschhorn)
    Re: When is an array @f allowed in a string? nobull@mail.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 8 Feb 2001 10:56:06 -0600
From: jstanley@mmm.com
Subject: Re: splitting a string on the / character
Message-Id: <95uj37$2a5$1@magnum.mmm.com>

If you know the answer to a question, answer it.  If you don't, or have a
smart ass comment on why the person should have known the answer, don't
answer it.  Think of it  this way.
If you are lost in a foreign town, would you appreciate it if when you asked
for directions, someone said "Look it up on the map".



"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m1k871qrx9.fsf@halfdome.holdit.com...
> >>>>> "Studio" == Studio 51 <leekembel@hotmail.com> writes:
>
> Studio> My point is that a lot of "helpful" replies seem to just be
> Studio> "read the man pages". That is not helpful,
>
> Yes it is.  If a clueful person can determine that the answer is
> derivable directly from the manpages, the original poster should be
> directed there first.  But if someone says "I've read manpage XYZ, and
> still don't understand it", I'm sure you'll find that we don't then
> say "well go back and read it again".  That *would* be rude.  Instead,
> we try to help explain if we can.
>
> But why should you waste the resources of Usenet as a simple Manpage
> Copy-N-Paste service?  That's silly.
>
> From the "worth repeating 27 more times department":
>
>         THIS IS NOT A HELP DESK.
>         THIS IS A COMMUNITY POTLUCK.
>         DON'T BOGART THE POTATO SALAD.
>         BRING A DISH IF YOU CAN.
>         DON'T WHINE IF NOBODY BROUGHT ICE CREAM.
>
> There.
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!




Opinions expressed herein are my own and may not represent those of my employer.



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

Date: 08 Feb 2001 09:26:02 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: splitting a string on the / character
Message-Id: <m1hf25nl1x.fsf@halfdome.holdit.com>

>>>>> "jstanley" == jstanley  <jstanley@mmm.com> writes:

jstanley> If you know the answer to a question, answer it.  If you
jstanley> don't, or have a smart ass comment on why the person should
jstanley> have known the answer, don't answer it.

That's what I do.  I think that's what most people do.  Sometimes, the
answer is RTFM, because the FM is much better than anything I could
type in a few minutes.

jstanley>   Think of it this way.  If you are lost in a foreign town,
jstanley> would you appreciate it if when you asked for directions,
jstanley> someone said "Look it up on the map".

If I wasn't holding a map, no.  But if I was holding a map, and didn't
know it was in the map, yes.  In fact, if they pointed right at the
part of the map where my destination was, even better.

And I think that fits here.

EVERYONE is holding a map.  MOST lazy people seem to want human help
instead of just simply looking on the map they are holding.  SOME
people don't know they are holding a map, so RTFMap is exactly
appropriate.  WE who answer hope that the RTFMap responses will
eliminate further questions that can be found by R'ingTFMap.

I do not discourage people from posting questions.  I do discourage
people from not at least *attempting* to use the tools provided for
them.  Lazy jerks, wasting resources.  Pissing on the potluck.

Dare I repeat (and mutate):

        THIS IS NOT A HELP DESK.
        THIS IS A COMMUNITY POTLUCK.
        DON'T WHINE BECAUSE SOMEONE DIDN'T BRING ICE CREAM.
        DON'T BOGART THE POTATO SALAD.
        BRING SOMETHING OCCASIONALLY, YOU BUM.  EVEN CHIPS.
        DON'T WHINE WHEN SOMEONE SAYS WE DON'T HAVE TABLE SERVICE.

That last one is the one you want, or even think you have a right to
have.  No, there is no table service in comp.lang.perl.misc.  It's all
self-serve.  Get unlazy, and get all the food you want.  It's
buffet-style, baby.  You gotta do some footwork yourself.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 08 Feb 2001 17:15:31 GMT
From: peter@uboat.berghold.net (Peter L. Berghold)
Subject: Re: This is driving me nuts and I need a guru
Message-Id: <slrn985l1j.q1g.peter@uboat.berghold.net>

On Mon, 5 Feb 2001 17:39:32 -0500, John W <jwgws@hotZEROSPAMmail.com> wrote:
>run across (of many I've participated in) where "Jeopardy-style" was such an

As much as I admire and respect the denizens of this NG I have noted 
before that they tend to be a rather sensitive lot. Newbies (not that 
you are one) get kicked rather resoundly here. Makes me wonder 
if they aren't trying for a "us 4 no more" news group. 

Now.. hopefully being honest in my assesment won't get me killfiled....


-- 
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Peter L. Berghold                        Peter@Berghold.Net
"Linux renders ships                     http://www.berghold.net
 NT renders ships useless...."           


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

Date: 08 Feb 2001 09:35:39 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: This is driving me nuts and I need a guru
Message-Id: <m1y9vhm61g.fsf@halfdome.holdit.com>

>>>>> "Peter" == Peter L Berghold <peter@uboat.berghold.net> writes:

Peter> As much as I admire and respect the denizens of this NG I have noted 
Peter> before that they tend to be a rather sensitive lot. Newbies (not that 
Peter> you are one) get kicked rather resoundly here. Makes me wonder 
Peter> if they aren't trying for a "us 4 no more" news group. 

Please remember that this newsgroup serves (in part) an unusual
audience... the people who think that "Perl can't be that hard because
I'm already 'programming' HTML".  So we end up having to deal with
multiple issues all at once... new to programming, new to web, new to
debugging, new to application design, wanting (or forced) to jump on
the web explosion, and yet things that make it look "easy" which
aren't, and things that look good but are truly broken.

The "C" newgroup had it much better, but I imagine the Java newsgroups
are probably feeling a similar strain.  I dread the thought of how
many JS programmers jump into the "java" groups because "isn't
javascript just java?".  Eeek.

And then we get people like you following up to "comp.lang.perl", a
dead group.  Why.  Why oh why.  Poorly administered Usenet systems,
still.  Sad.

The net is ripping at the seams, it seems.  I won't go so far as to
say "imminent death of the net predicted, film at 11", because I've
seen that phrase used far too often.  But it's gonna have to get
different about how people interact with each other here for it to
scale bigger.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Thu, 8 Feb 2001 10:06:51 -0500
From: "Valen1260" <sshewmaker@transy.edu>
Subject: Re: Validating date formats
Message-Id: <95uckn$qtc$1@news.uky.edu>

I'm not sure how you're using this, but you could grab 5 substrings and see
if they are within whatever limits you want to set (0-23 for HH, etc).




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

Date: 08 Feb 2001 17:43:42 +0000
From: nobull@mail.com
Subject: Re: Validating date formats
Message-Id: <u9hf25yss1.fsf@wcl-l.bham.ac.uk>

"Martin Toman" <mtoman@bfsec.bt.co.uk> writes:

> Can anyone tell me the best way to check that a string is in a particular
> date format; ie;
> 
> DDMMYYhhmm

Ask the person who is providing the data.

For dates like today's (8-Feb-2001) it is fundamentally impossible to
destinguish the following date formats without external queues.

DDMMYYhhmm
MMDDYYhhmm
YYMMDDhhmm

This has nothing to do with Perl or even computers.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 08 Feb 2001 15:48:20 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: When is an array @f allowed in a string?
Message-Id: <3a82bfc4.579c$290@news.op.net>


In article <3a824e33$0$17470$b45e6eb0@senator-bedfellow.mit.edu>,
Philip Hirschhorn <psh@math.mit.edu> wrote:
>Can anyone explain when perl believes that @f inside a string means
>"interpolate the array @f" and when it assumes that you just wanted to
>have those two characters there?  I'd appreciate a reference to
>wherever I can read about this.

See

        http://perl.plover.com/at-error.html

for a complete explanation.
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Thu, 08 Feb 2001 16:06:40 GMT
From: aramis1631@my-deja.com
Subject: Re: When is an array @f allowed in a string?
Message-Id: <95ug68$smm$1@nnrp1.deja.com>

In article <3a824e33$0$17470$b45e6eb0@senator-bedfellow.mit.edu>,
  psh@math.mit.edu (Philip Hirschhorn) wrote:
> My apologies for asking a question that I should probably able to
> remember where I've seen answered before, but I'm stumped.  If I run
> the script
>
> --------------------------------------------------------------------
> #! /usr/bin/perl -w
>
> &makepoly;
> print "f = @f\n";
> exit(0);
>
> sub makepoly {
>     $f[0] = 0;
>     $f[1] = 1;
>     $f[2] = 2;
> } # makepoly
> --------------------------------------------------------------------
>
> Then I get the error mesage:
>
> In string, @f now must be written as \@f at printtest line 4, near "f
= @f"
> Execution of printtest aborted due to compilation errors.
>
> However, if I add the line
>
> @f = (5, 6);
>
> just above the call to makepoly, there are no error messages and the
> output is:
>
> f = 0 1 2
>
> Apparently perl doesn't look ahead to see that makepoly defines the
> array @f and it assumes I mean to type the actual character @ followed
> by an f.
>
> Can anyone explain when perl believes that @f inside a string means
> "interpolate the array @f" and when it assumes that you just wanted to
> have those two characters there?  I'd appreciate a reference to
> wherever I can read about this.
>
> My thanks for any help on this.
>
> Phil Hirschhorn

I think you already understand the essence of the error. I suggest you
use the strict pragma. Had you been using strict, you could not have
made the error. Use the vars pragma to predefine your global variables.

use strict;
use vars qw(@f);   #predefine the global variable @f

makepoly();
print "f = @f\n";
exit(0);

sub makepoly {
    $f[0] = 0;
    $f[1] = 1;
    $f[2] = 2;
} # makepoly

TMTOWTDI - you might choose to avoid using global variables by passing
makepoly a reference to the array and let makepoly populate the array.


Sent via Deja.com
http://www.deja.com/


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

Date: 08 Feb 2001 17:59:13 GMT
From: psh@math.mit.edu (Philip Hirschhorn)
Subject: Re: When is an array @f allowed in a string?
Message-Id: <3a82de71$0$17481$b45e6eb0@senator-bedfellow.mit.edu>

Mark Jason Dominus (mjd@plover.com) wrote:

: In article <3a824e33$0$17470$b45e6eb0@senator-bedfellow.mit.edu>,
: Philip Hirschhorn <psh@math.mit.edu> wrote:
: >Can anyone explain when perl believes that @f inside a string means
: >"interpolate the array @f" and when it assumes that you just wanted to
: >have those two characters there?  I'd appreciate a reference to
: >wherever I can read about this.

: See

:         http://perl.plover.com/at-error.html

: for a complete explanation.

Thank you!!  A wonderfully complete and thorough explanation!

Thanks also to those who suggested "use diagnostics" and "use strict";
I should probably get into that habit.

Phil

--
----------------------------------------------------------------------
Philip Hirschhorn          psh@math.mit.edu
                           psh@poincare.wellesley.edu
----------------------------------------------------------------------


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

Date: 08 Feb 2001 18:01:08 +0000
From: nobull@mail.com
Subject: Re: When is an array @f allowed in a string?
Message-Id: <u98znhyryz.fsf@wcl-l.bham.ac.uk>

bernard.el-hagin@lido-tech.net (Bernard El-Hagin) writes:

> On 08 Feb 2001 07:43:47 GMT, Philip Hirschhorn <psh@math.mit.edu> wrote:

> >In string, @f now must be written as \@f at printtest line 4, near "f = @f"
> >Execution of printtest aborted due to compilation errors.

> Place the line:
> 
> use diagnostics;
> 
> at the top of your script and you'll get your answer.

Really?  Are you sure?  Have you tried it?  I tried it and I got a
verbose explaination of "Execution of %s aborted due to compilation
errors" not "In string...".

I think it would be better to direct the OP to read perldiag.

> #requires 5.6.0

Ah.

I think it's too soon to assume everyone has 5.6

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

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 V10 Issue 246
**************************************


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