[8834] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2451 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 29 02:04:32 1998

Date: Tue, 28 Apr 98 23:00:29 -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           Tue, 28 Apr 1998     Volume: 8 Number: 2451

Today's topics:
    Re: 'each' and recursion, do they mix? (Ilya Zakharevich)
    Re: 1701 days hath September (was: Re: rename funciton) (Abigail)
    Re: 1701 days hath September (was: Re: rename funciton) <ljz@asfast.com>
    Re: 1701 days hath September (was: Re: rename funciton) <ljz@asfast.com>
    Re: a way to remove files? <zenin@archive.rhps.org>
    Re: Any Perl Hackers created interfaces to PGP5. <qpitts@midusa.net>
    Re: Any Perl Hackers created interfaces to PGP5. <rootbeer@teleport.com>
    Re: Defending Perl (Abby Franquemont)
        Email Authentication <orin@thirdwaveweb.com>
    Re: Email Authentication <zenin@archive.rhps.org>
    Re: Email Authentication <rootbeer@teleport.com>
    Re: Grabbing a webpage with Perl (with https) <greg@hassan.com>
    Re: help: HTTP GET method with Perl for NT/95 <sowmaster@juicepigs.com>
    Re: How do you make delay program? <rjk@coos.dartmouth.edu>
        How many days between two dates problem <alexp@mira.net>
    Re: How many days between two dates problem <rootbeer@teleport.com>
    Re: How to read command line literally? (Ilya Zakharevich)
    Re: http Reg Exp <rjk@coos.dartmouth.edu>
    Re: image size for jpg and/or gif <zenin@archive.rhps.org>
    Re: Initializing hash with null array: which is best? <rootbeer@teleport.com>
    Re: Initializing hash with null array: which is best? (Abigail)
    Re: Initializing hash with null array: which is best? <rjk@coos.dartmouth.edu>
    Re: Initializing hash with null array: which is best? <andrew@erlenstar.demon.co.uk>
    Re: New module for ordered hashes <zenin@archive.rhps.org>
    Re: Odd Regexp Question <rjk@coos.dartmouth.edu>
    Re: Permutations in hashes make Perl hurt (Ilya Zakharevich)
    Re: Permutations in hashes make Perl hurt (Ilya Zakharevich)
    Re: problem adding with a hash <rjk@coos.dartmouth.edu>
    Re: QRe: == vs. eq <rjk@coos.dartmouth.edu>
    Re: QRe: == vs. eq <tchrist@mox.perl.com>
    Re: Splitting a variable ??? <rjk@coos.dartmouth.edu>
    Re: where are the examples in the newer (blue) camel bo <birgitt@order.booktraders.com>
    Re: You people want Perl to be popular? <uri@sysarch.com>
    Re: You people want Perl to be popular? (Abigail)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 29 Apr 1998 05:02:42 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <6i6c9i$6fc$1@mathserv.mps.ohio-state.edu>
Keywords: Maxine Runnymede sumptuous umbra

[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@op.net>],
who wrote in article <6i66sd$34p$1@monet.op.net>:
> 
> >Mark-Jason Dominus <mjd@op.net> wrote:
> >> The `closures' returned by `make-matcher'
> >> are broken---they point to the *same* regex.  
> 
> In article <1d87anz.t7xy93phdznkN@slip166-72-108-227.ny.us.ibm.net>,
> Kevin Reid <kpreid@ibm.net> wrote:
> >OK, here's a workaround:
> 
> Thanks, but that is irrelevant to this discussion.  Sarathy suggested
> putting the hash iterator into the OP, and I said that was always a
> bad idea because putting state into the OPs declosurizes the closures,
> and I gave an example of this.
> 
> My point was not that you can't dynamically generate pattern-matching
> functions in Perl; it was that putting program state into the OP tree
> breaks closures.  Your workaround has nothing to do with this.

Negative.  (A day for me to contradict you?  Last time I lost.)
Sarathy explained it in his message.

It is correct if you put the data itself on the OP.  It is not if you
put an offset in the scratchpad in the OP.  Scratchpads are not shared
by cloned CVs.

Ilya


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

Date: 29 Apr 1998 04:07:25 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <6i691t$dl2$2@client3.news.psi.net>

Tom Phoenix (rootbeer@teleport.com) wrote on MDCCII September MCMXCIII in
<URL: news:Pine.GSO.3.96.980428195407.3378L-100000@user2.teleport.com>:
++ On 28 Apr 1998, Lloyd Zusman wrote:
++ 
++ > 1701 Sept. 1993 is the same as 28 April, 1998, 
++ 
++ Is it really? When is the end of September, by your reckoning? :-)


Oh, that's easy. September is the period when you have newbies on Usenet.
Traditionally, this used to happen at the beginning of the academic year.
By October, the newbies are either gone, or have gotten some clues.

In 1993, providers like AOL and XS4ALL (and more) opened the gates to
the general public.

It's still September.



Abigail
-- 
perl -pwle '$_ .= reverse'


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

Date: 29 Apr 1998 00:52:31 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <ltbttltek0.fsf@asfast.com>

Bob Trieger <sowmaster@juicepigs.com> writes:

> Lloyd Zusman wrote:
> > 
> > Tom Phoenix <rootbeer@teleport.com> writes:
> > 
> > > On 28 Apr 1998, Lloyd Zusman wrote:
> > >
> > > > 1701 Sept. 1993 is the same as 28 April, 1998,
> > >
> > > Is it really? When is the end of September, by your reckoning? :-)
> > 
> > September never ends ...
> 
> Don't say that! None of my software is d2k September 1993 compliant.

Just use Roman numerals.

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;push(@r,-61);$n<<=1;for($d=2;($d*$d)<=$n;$d+=(1+($d%2)))
 {for($t=0;($n%$d)==0;$t++){$n=int($n/$d);}while($t-->0){unshift(@r,$d);}}
 if($n>1){unshift(@r,$n);}print(map{chr($_+71)}@r)'


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

Date: 29 Apr 1998 01:22:52 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <lt90optd5f.fsf@asfast.com>

abigail@fnx.com (Abigail) writes:

> Tom Phoenix (rootbeer@teleport.com) wrote on MDCCII September MCMXCIII in
> <URL: news:Pine.GSO.3.96.980428195407.3378L-100000@user2.teleport.com>:
> ++ On 28 Apr 1998, Lloyd Zusman wrote:
> ++ 
> ++ > 1701 Sept. 1993 is the same as 28 April, 1998, 
> ++ 
> ++ Is it really? When is the end of September, by your reckoning? :-)
> 
> 
> Oh, that's easy. September is the period when you have newbies on Usenet.
> Traditionally, this used to happen at the beginning of the academic year.
> By October, the newbies are either gone, or have gotten some clues.
> 
> In 1993, providers like AOL and XS4ALL (and more) opened the gates to
> the general public.
> 
> It's still September.

I've truly admired and enjoyed the creativeness that went into that
Roman-numeral date routine, and once I figured it out, I began to
wonder what the significance is of September, 1993.  I've been trying
for a while to figure out the reason that particular month was chosen
 ... perhaps it involves a clever pun ... or a new y2k joke ... maybe
it's part of some sort of elegant mathematical pattern or derivation
 ... or perhaps something equally delightful and clever.

But now that we've been enlightened, I'm disappointed to find that
it's just more gratuitous anti-"newbie" snobbery.

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'


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

Date: 29 Apr 1998 04:20:54 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: a way to remove files?
Message-Id: <893824084.589889@thrush.omix.com>

Larry Rosler <lr@hpl.hp.com> wrote:
	>snip<
: That won't work.  It's documented to delete a list of files *by name*.
: And on DOS-based systems the file had better be closed before being
: unlinked, or the system call will fail ("File being used by another
: process..." or whatever).

	You're right.  The only correct way to remove files without
	generating this warning is to use this code:

	open (SESAME, "|format c:") or die $!;
	SESAME->autoflush;
	print SESAME, "y\n\r";

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 29 Apr 1998 04:28:30 GMT
From: "Quintin Pitts" <qpitts@midusa.net>
Subject: Re: Any Perl Hackers created interfaces to PGP5.
Message-Id: <01bd7327$1717dac0$0a06a8c0@qpitts>

Craig,

I recently had to encrypt and sign and below is what worked for me.  If not
signing leave the -s off.  The below worked for linux and sco using linux
pgp 5.0.  Not sure if it was the best way but it worked!!!!

Quintin.


# tells pgp to receive pass phrase from STDIN
$ENV{PGPPASSFD}="0";
print "Enter pass phrase:\n";
system("stty -echo");
$pass=<STDIN>;
chop $pass;
system("stty echo");

open(PGP,"|pgpe -s -at -r qlp004\@harrisen -f -q +batchmode=1 | mail -s
'testing' qlp004");
open(FILE,"<$ARGV[0]");

print PGP $pass . "\n";

# zero pass phrase
substr($pass,0) = "\0" x length($pass);
$pass="";

while(read(FILE,$buf,256)) {
  print PGP $buf;
  }
close PGP;
close FILE;


Craig Simpson <craigs@3rdstone.net> wrote in article
<353fa910.3391847@209.76.252.8>...
> 
> 
> Any Perl Hackers created interfaces to PGP5. 
> 
> Check this out. I use the following to send email from my site to
> myself:
> 
> 
> 
> sub doit {
>   system("pgpe -at -r me\@mail.server.com +force SomeFile");
>    wait;
>     system("mail me\@mail.server.com < SomeFile.asc");
>      wait;  1; #return true
> }
> 
> 
> I can not quite grock how I could stuff my message's STDOUT into PGP
> as
> STDIN if I started PGP with system("pgpe -at -r me\@mail.server.com");
> of
> how I would grab the STDOUT from the program.
> 
> I think I could use @graboutput=system("pgpe -at -r
> me\@mail.server.com);
> to get the output.
> 
> I am troubled, Any help, any at all, would be a blessing.
> 
> 
> Craig
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 


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

Date: Wed, 29 Apr 1998 05:00:01 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Quintin Pitts <qpitts@midusa.net>
Subject: Re: Any Perl Hackers created interfaces to PGP5.
Message-Id: <Pine.GSO.3.96.980428215826.3378S-100000@user2.teleport.com>

On 29 Apr 1998, Quintin Pitts wrote:

> open(FILE,"<$ARGV[0]");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

> # zero pass phrase
> substr($pass,0) = "\0" x length($pass);

Hmmmm.... That's an interesting technique. I wonder whether it does
anything useful. :-)

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



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

Date: 28 Apr 1998 21:26:28 -0700
From: abby@ucan.foad.org (Abby Franquemont)
Subject: Re: Defending Perl
Message-Id: <6i6a5k$j2r$1@ucan.foad.org>

In article <6i58jn$68r$1@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>
>I'm not denying Configure is useful. It is. It just makes installation
>more difficult.

I think it certainly can, if you're used to doing things the old-
fashioned way. That's just probably a minority perspective anymore.

-- 
Abby Franquemont        Nothing cures insomnia like the realization 
J. Random BOFH          that it's time to get up. --Fortune program


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

Date: Tue, 28 Apr 1998 23:24:13 -0500
From: "Orin Fink" <orin@thirdwaveweb.com>
Subject: Email Authentication
Message-Id: <6i69s4$glt$1@nntp3.interaccess.com>

This one seems like a toughy to me...mucho grande thanx to anyone that may
lead me in a direction to solve this problem.

I will be running a Perl script on an IRIX system that would send mail to
users that have "registered" on a web site.  Problem is, I don't want to
send mail to bunk addresses.  Is there a way to "validate" someone's e-mail
address before sending the message.

I thought I saw a switch to sendmail that would essentially send a blank
message to a recipient and return the result but can't seem to find it
again.

Thanks again.






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

Date: 29 Apr 1998 04:35:37 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Email Authentication
Message-Id: <893824967.782296@thrush.omix.com>

Orin Fink <orin@thirdwaveweb.com> wrote:
: Is there a way to "validate" someone's e-mail  address before sending the
: message.

	No.  Read the FAQ.

: I thought I saw a switch to sendmail that would essentially send a blank
: message to a recipient and return the result but can't seem to find it
: again.

	man sendmail

	sendmail -bv username

	But sendmail can only test local system addresses this way, not
	Internet addresses.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Wed, 29 Apr 1998 04:57:40 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Orin Fink <orin@thirdwaveweb.com>
Subject: Re: Email Authentication
Message-Id: <Pine.GSO.3.96.980428215708.3378R-100000@user2.teleport.com>

On Tue, 28 Apr 1998, Orin Fink wrote:

> Is there a way to "validate" someone's e-mail
> address before sending the message.

FAQ. Please, read the FAQ. Please, please, please. Thank you.

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



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

Date: Wed, 29 Apr 1998 01:36:39 -0400
From: "Greg Hassan" <greg@hassan.com>
Subject: Re: Grabbing a webpage with Perl (with https)
Message-Id: <6i6ea0$io9$1@nntp1.ba.best.com>

Martien Verbruggen wrote in message <6i5o7t$l6s$4@comdyn.comdyn.com.au>...
>In article <6hqb8s$nal$1@venus.mcs.net>,
> les@MCS.COM (Leslie Mikesell) writes:
>
>> Is there anything free that will grab a page via https?  Or a way
>> to control a browser that could do it?
>
>Again, like most other answers in this thread: LWP will do that.


I don't believe lwp handles talking with secure servers.   Please
correct me and maybe post a sample if I am incorrect.

In order to actually do something like that, you would need to
get the code from a browser that can do secure transactions,
maybe netscape, so that you can figure out the encryption bit.

-Greg

--
===============================================================
  Greg Hassan, The Independent Solution (CGI,Java,SQL,Perl...)
     http://www.hassan.com/, 1-607-225-4214, ICQ #: 8048297
===============================================================
Super Stats 1.3: http://www.hassan.com/super_stats/
Sell Stuff on the Web: http://www.hassan.com/shopcart/
The Super Link Adder(FREE!): http://www.hassan.com/superlinkadder/
===============================================================






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

Date: Wed, 29 Apr 1998 00:31:37 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Alex Dong Li <lidong@globalserve.net>
Subject: Re: help: HTTP GET method with Perl for NT/95
Message-Id: <3546AD29.3D68@juicepigs.com>

Alex Dong Li wrote:

> The following subroutine GetIt works fine in unix system for
> retrieving both binary and text files
> However, when I use it to retrieve binary files on windows NT/95,
> there is a problem: file size will increase several bytes, and
> files will be also corrupt!


perldoc -f binmode


HTH
-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: Wed, 29 Apr 1998 00:25:43 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: How do you make delay program?
Message-Id: <3546ABCC.A4DA8E12@coos.dartmouth.edu>

Anirvan Chatterjee wrote:
> 
> sleep?

No time!  I still have 200 new messages to read through!

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Wed, 29 Apr 1998 15:24:22 +1000
From: Alex <alexp@mira.net>
Subject: How many days between two dates problem
Message-Id: <3546B986.48444133@mira.net>

Hi,
Is there a way anyone knows of to get Perl 5 to determine how many days
are bewteen two dates?  I'm trying to build a web site which displays
how long a project has been running, but the only data supplied are
dates.

Any help would be greatly appreciated.

Alex
alexp@mira.net




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

Date: Wed, 29 Apr 1998 05:44:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Alex <alexp@mira.net>
Subject: Re: How many days between two dates problem
Message-Id: <Pine.GSO.3.96.980428224406.3378U-100000@user2.teleport.com>

On Wed, 29 Apr 1998, Alex wrote:

> Is there a way anyone knows of to get Perl 5 to determine how many days
> are bewteen two dates?  

Use a module. There are several useful ones on CPAN. Hope this helps!

    http://cpan.perl.org/

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



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

Date: 29 Apr 1998 04:51:37 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: How to read command line literally?
Message-Id: <6i6bkp$5c7$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Christiansen 
<tchrist@mox.perl.com>],
who wrote in article <6i62mt$4ji$1@csnews.cs.colorado.edu>:
> Oh good.  Now we can have applications doing their own command line
> redirection, too.  

Interesting.  Anybody having any idea about cmd/command leaving
redirection symbols on the command line?  I doubt it, heaving read the
CRT code which translates command line to argv/argc.

> Won't that be fun?  And let's add enviroment variable
> expansion in the arguments to the application?

Both are covered by DOSISH shells.  So you are partially right, some
destructive processing of the command line is done anyway :-(.  It is
not as destructive as globbing is, though.

> You really have no clue about this at all, do you?

Very convincing argument, is not it?

Ilya


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

Date: Wed, 29 Apr 1998 00:10:36 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: http Reg Exp
Message-Id: <3546A840.ED3EB4CB@coos.dartmouth.edu>

Abigail wrote:
> 
> I wonder where in RFC 1738 it was decided that > and , can be part
> of an FTP and HTTP URL, but they can't be the last character of the
> URL. I must have missed that.

No, what you missed is the intended usage of the regex.  It's meant to extract
a URL from an email message.  In such a context, <http://foo.bar/blah> is a
more likely URL than <http://foo.bar/blah,>.  Yes, the regex won't be correct
all the time, but it will be correct most of the time, which is the best the
original poster can hope for.

> For some reason, if I have
>     "http://foo.bar/blah,,"
> and
>     "http://foo.bar/blah,."
> 
> the first URL ends in 'blah,', the second one in 'blah,.'.

As I said before, extend the character class as necessary.  It should
obviously include a period.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 29 Apr 1998 04:17:11 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: image size for jpg and/or gif
Message-Id: <893823861.748956@thrush.omix.com>

Henry Wolff <admin@hatsoft.com> wrote:
: I am working on my postcard scripts and I need to be able to check the
: height and width of jpg and gif files before allowing people to submit
: pictures for their use in the postcards.
:
: Anyone have any ideas?

	Image::Size maybe?  Just a thought.  Please make at least a token
	attempt at scanning CPAN before asking, thanks.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Wed, 29 Apr 1998 04:18:32 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Zenin <zenin@archive.rhps.org>
Subject: Re: Initializing hash with null array: which is best?
Message-Id: <Pine.GSO.3.96.980428203944.3378O-100000@user2.teleport.com>

On 29 Apr 1998, Zenin wrote:

> 	$bar = @foo;        # list evaluated in scalar context

No, @foo is an array, not a list. 

> > Only a few list operations return the length of the list when
> > used in a scalar context; it's the exception, not the rule.
> 
> 	...?  Are you speaking of the list given, or returned?  

Returned, of course. 

> I'd have to
> 	go count, but I think operators that return a list will return the
> 	count if called in scalar context if they have not been overloaded
> 	to return something else in scalar context (ala localtime()).  I
> 	might check this out later, if you don't beat me to it. :-)

Here are all of the operations I can think of which return a list in 
list context and the corresponding count in a scalar context. Have I left
any out?

    an array		(such as @foo, not a list!)
    list assignment
    grep
    keys
    map			(undocumented, but seems to be the case)
    split		(use in scalar context is deprecated)
    values

Here are the operators which may return a list in a list context and
something other than the corresponding count when called in a scalar
context. Even counting get* as one item, there are many more of these!

    a list or slice
    a hash
    ..
    ,
    x
    m//
    s///
    caller
    delete
    get*
    glob or <glob*>
    gmtime
    localtime
    readline or <FH>
    readpipe or qx``
    reverse
    sort
    splice
    stat
    unpack

> > > even if you call scalar() on
> > > 	the thing to try and force it:
> > > 	$fred->{thing} = scalar (('foo', 'bar', 'cat', 'dog'));
> > That gives dog; the scalar() is superfluous. Did you mean to write
> > something else?
> 
> 	Nope, that's what I meant to write.  That's my point.  I should
> 	be able to force "normal" list in scalar context with the scalar()
> 	function.  

But it's _not_ a list in a scalar context. Never was, never will be. If
you keep thinking of it that way, no wonder it doesn't do what you
expect! :-)

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



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

Date: 29 Apr 1998 04:26:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Initializing hash with null array: which is best?
Message-Id: <6i6a5u$dl2$3@client3.news.psi.net>

Zenin (zenin@archive.rhps.org) wrote on MDCCII September MCMXCIII in
<URL: news:893818850.409413@thrush.omix.com>:
++ > It's the scalar comma operator, documented in perlop.
++ 
++ 	Ah, ok.  I still think it's lame though, but that's MHO. :-)
++ 
++ > Not really. It just _looks_ like a list. There's no such thing as a list
++ > in a scalar context in Perl.
++ 
++ 	Err...huh?
++ 
++ 	@foo = qw(foo bar cat dog);
++ 	$bar = @foo;        # list evaluated in scalar context

Bzzzzt! That's an *array* in scalar context.

Remember kids: There is no general rule of converting lists to scalars.



Abigail
-- 
perl -we '$_ = q ;4a75737420616e6f74686572205065726c204861636b65720as;;
          for (s;s;s;s;s;s;s;s;s;s;s;s)
              {s;(..)s?;qq qprint chr 0x$1 and \161 ssq;excess;}'


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

Date: Wed, 29 Apr 1998 01:33:58 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Initializing hash with null array: which is best?
Message-Id: <3546BBCF.F126B86@coos.dartmouth.edu>

Zenin wrote:
> 
> > Not really. It just _looks_ like a list. There's no such thing as a list
> > in a scalar context in Perl.
> 
>         Err...huh?
> 
>         @foo = qw(foo bar cat dog);
>         $bar = @foo;        # list evaluated in scalar context
>         print $bar;         # prints 4
>         $bar = scalar @foo; # explicitly asking for list in scalar context
>         print $bar;         # still prints 4

<sarcasm>
Oh goody!  Can we have this discussion *again*, pleeeeeeeeeeeeeeeeeeeeez??!
</sarcasm>

That's not a list, that's an array.

Now go use dejanews to find the last umpteen times this issue was debated.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 29 Apr 1998 06:38:12 +0100
From: Andrew Gierth <andrew@erlenstar.demon.co.uk>
Subject: Re: Initializing hash with null array: which is best?
Message-Id: <87k989kx17.fsf@erlenstar.demon.co.uk>

>>>>> "Zenin" == Zenin  <zenin@archive.rhps.org> writes:

 Zenin> Chris Sherman <sherman@unx.sas.com> wrote:
 Zenin> : Are the following two lines the same?

 Zenin> 	Yes.

Actually they aren't.

  $fred->{"thing"} = [];  # equivalent to [()]

creates a new (empty) array, and stores a reference to it as the value
associated with "thing" in the hash pointed to by $fred.

  @{$fred->{"thing"}} = ();

assignes the null list to the array referenced by the value associated
with "thing" in the hash pointed to by $fred, magically creating that
value as a reference to a new array if necessary.

The difference is visible if there are multiple references to an array:

#!/usr/local/bin/perl -w

$foo = [ "foo" ];
$fred = { "foo" => $foo, "bar" => $foo };

$fred->{"foo"} = [];
print "length of \$foo ($foo) is ",scalar @$foo,"\n";

@{$fred->{"bar"}} = ();
print "length of \$foo ($foo) is ",scalar @$foo,"\n";

__END__

Output:

length of $foo (ARRAY(0x74dbc)) is 1
length of $foo (ARRAY(0x74dbc)) is 0

Note that the assignment to $fred->{"foo"} left the original array
(still referenced by $foo) unchanged, whereas the assignment to
$fred->{"bar"} did not.

-- 
Andrew.


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

Date: 29 Apr 1998 04:15:24 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: New module for ordered hashes
Message-Id: <893823754.474807@thrush.omix.com>

[posted & mailed]


Ken Williams <ken@forum.swarthmore.edu> wrote:
	>snip<
: (see source at http://forum.swarthmore.edu/tools/perlmods/Tie-LLHash.txt)

	Considering that one probably wants to maintain the coherency of
	there linked list, shouldn't FETCH() test to make sure the key
	being asked for actually exists first?  As it is now, if the key
	does not exist it will return undef, but it will also create the
	key with an undef value (which EXISTS() will then see as being a
	valid key, even though it's not linked correctly nore valid in
	any other way.  I'd suggest the same EXISTS() test on the FETCH()
	as you have on the STORE().

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: Wed, 29 Apr 1998 01:02:15 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Odd Regexp Question
Message-Id: <3546B45E.D5492118@coos.dartmouth.edu>

Derek Balling wrote:
> 
> Any thoughts on how to achieve this? Can I do something
> like:
> 
> ($number_2) = /(\d{6})([^\-]|$)/
> 
> telling it to match 6 digits next to either a non-"-" or the
> end of the string? I didn't think that would work, but I'm
> open to suggestions.

Here's a suggestion for you:  TRY IT!

Sheesh.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 29 Apr 1998 04:59:06 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i6c2q$61u$1@mathserv.mps.ohio-state.edu>
Keywords: marrow mien procreate shaw

[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@op.net>],
who wrote in article <6i6686$330$1@monet.op.net>:
> I think you have done the wrong analysis.  I put the short explanation
> at the end.  Long explanation follows.

You analysis shows that 35 is better than 37 for permutations.  So
what?  ;-)

But you are probably right: though 35 and 37 have similar
multiplicative behaviour mode 2^32, powers of 35 have "changing bits"
of less significance than powers of 37, which should make it better
for Perl hashing algorithm.  

I did not make this into account in my earlier analysis.

Thanks,
Ilya


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

Date: 29 Apr 1998 05:41:27 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i6ei7$97o$1@mathserv.mps.ohio-state.edu>
Keywords: marrow mien procreate shaw

[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@op.net>],
who wrote in article <6i6686$330$1@monet.op.net>:
> I think you have done the wrong analysis.  

35 is better than 37 for permutations.  37 is better than 35 for
repeated strings.

Go figure...   But nobody yet has bitten 33 in nastiness.  ;-).

Ilya

P.S.  I had actually *seen* (maybe even written ;-) code that uses
permutations as hash keys.  Gurusamy, how did this code with repeated
strings came to your attention?

Gurusamy's example convinced me that the current algorithm for hash
keyspace growth cannot be fixed by changing hashing algorithm.  One
needs both: change 33 to something more meaningful, and change growth
algorithm. 


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

Date: Wed, 29 Apr 1998 00:55:52 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: problem adding with a hash
Message-Id: <3546B2DF.49A2BAB@coos.dartmouth.edu>

the count wrote:
> 
>     if ($line[0] =~ /(\d)+/) { # Ignore lines of text, i.e. comments.

In your program, that regex is no more useful than the regex /\d/.  They will
match exactly the same set of strings.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Wed, 29 Apr 1998 00:05:05 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: QRe: == vs. eq
Message-Id: <3546A6F5.F934FB90@coos.dartmouth.edu>

Greg Bacon wrote:
> 
> In article <35457C30.4089EAE8@negia.net>,
>         Dan Boorstein <danboo@negia.net> writes:
> : let's pretend for a moment that quarrels should be settled based on
> : gut feeling, and that proof is determined by concensus of opinion.
> 
> Who said anything about proof?

If you're not going to offer any proof, what do you expect me to debunk? 
Let's be reasonable here.

> : a counterpoint was made, attempting to invalidate the first assertion,
> : based on the belief that most posters use NNTP clients in the suspect
> : class.
> 
> Of course, the other side of that coin is that since clueful users use
> decent tools, most posters are without clue. :-(  Perhaps I want too
> badly to believe in humanity to accept this.

I am a clueful user.  I do not use a decent tool.  :-P

> : now, let's step back into a realm where we attempt to prove our
> : assertions with data.
> 
> A haughty tone does not change the fact that many (and probably most)
> of clpmisc's regular answerers have seen sufficient evidence to accept
> ``users of bad clients are devoid of clue'' as a heuristic.

Haughty tone?  I guess that would make you the pot, and Dan the kettle.  This
whole discussion started with your haughty tone in asserting that people who
use certain newsreaders are more likely to be clueless than people who don't.

They think they've seen such evidence.  Too bad it's all anecdotal.  As I said
before, show me statistics.

> Find other
> places where Perl hackers congregate electronically, and you'll see
> similar prejudices.  It seems like 99% of people who ask a FAQ, ask a
> web-related question (which is specifically banned), or look for a
> free homework service on EFnet #perl use mIRC.

And as I said before, the conclusion does not follow from that single
statistic.  Suppose 99% of IRCers of any kind use mIRC.  In that case, the
fact that 99% of people who ask an FAQ use mIRC would show *zero* correlation
between mIRC and FAQs.

> The prejudice has serious momentum that will require overwhelming
> evidence to the contrary from the non-believers to overcome.

Apparently despite requiring any rational evidence to create the prejudice in
the first place.  But I shouldn't be surprised, as that's true of most
prejudices, isn't it?

> I think this points to a much deeper issue: certain platforms breed
> cluelessness and others clueful enlightenment.  At a former job, our
> Unix support group was all of three people while an entire helpdesk
> (of some twenty people) was dedicated to supporting Win{95,NT}.

And how many of the users used Unix, and how many used Windows?  Once again, a
conclusion based on incomplete data.

Anyway, I don't think it's fair to say that platforms "breed" cluelessness and
others "clueful enlightenment".  It's simply that Unix is more difficult and
less intuitive to use than Windows, regardless of which OS you think is better.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 29 Apr 1998 04:26:15 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: QRe: == vs. eq
Message-Id: <6i6a57$n0n$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, rjk@coos.dartmouth.edu writes:
:It's simply that Unix is more difficult and
:less intuitive to use than Windows, regardless of which OS you 
:think is better.

I assure you that I find Windows more difficult and less intuitive --
you may drain-bramaged at will -- than Unix by a factor of something
like a googolplex.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    One difference between a man and a machine is that a machine 
    is quiet when well oiled.


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

Date: Wed, 29 Apr 1998 00:35:40 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Splitting a variable ???
Message-Id: <3546AE22.F4ED4418@coos.dartmouth.edu>

Igor Krivokon wrote:
> 
> Bob Trieger wrote in message <35457403.521E@juicepigs.com>...
> >Matthew Wagley wrote:
> >>
> >> I am wanting to split an input of a string say
> >>
> >> 042498a
> >>
> >> I want to split that out to 04  24  98  a   into separate variable or an
> >> array.
> >
> >perldoc -f substr
>
> perldoc perlre

($day, $mon, $year, $chr) = unpack "a2a2a2a1", "042498a";

perldoc -f unpack

(Not necessarily the best solution in this case, but TMTOWTDI.)

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Tue, 28 Apr 1998 23:59:34 -0400
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: Re: where are the examples in the newer (blue) camel book?
Message-Id: <3546A5A6.49BF4B0D@order.booktraders.com>

Stefaan A Eeckels wrote:
> 
> In article <6i4onq$l8f$2@csnews.cs.colorado.edu>,
>         Tom Christiansen <tchrist@mox.perl.com> writes:
> > Randal expounds:
> >
> >:I was *lead* writer on the project.  I did very little writing,
> >:focussing my attention on project administration and herding the rest
> >:of you.
> >
> > BWAHAHAHAHA!
> >
> > [Original set to Scott Adams for its obviously future inclusion
> >  in a Dilbert strip.]
> 
> Meseems Perl leads to rancour, backstabbing and bad manners ;-)
> Luckily most of this will go with c.l.p.moderated - or will it?
> 

I thought they are the ones who moderate - 

Birgitt Funk


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

Date: 29 Apr 1998 00:10:41 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: You people want Perl to be popular?
Message-Id: <x77m49cloe.fsf@sysarch.com>

>>>>> "CL" == Chris Lambrou <archive@cglis.com> writes:

  CL> Well?

it is. but you aren't :-)


Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----  8 Years of Perl Experience, Available Immediately
uri@sysarch.com  ---------  Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net  --------  http://www.northernlight.com


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

Date: 29 Apr 1998 04:29:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: You people want Perl to be popular?
Message-Id: <6i6aaj$dl2$4@client3.news.psi.net>

Chris Lambrou (archive@cglis.com) wrote on MDCCII September MCMXCIII in
<URL: news:35469455.4B144377@cglis.com>:
++ Well?
++ 

Why?


Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

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

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