[8624] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2241 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 3 11:07:29 1998

Date: Fri, 3 Apr 98 08:00:32 -0800
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, 3 Apr 1998     Volume: 8 Number: 2241

Today's topics:
    Re: [SOURCE] rot90: New and better MIME format (Malcolm Beattie)
    Re: [SOURCE] rot90: New and better MIME format <quentin.fennessy@amd.com>
    Re: [SOURCE] rot90: New and better MIME format (Kevin Reid)
    Re: Anon Scalar Expression (was: Evaluate expression in <jdporter@min.net>
    Re: contexts: is there such a thing as array? <spider@Orb.Nashua.NH.US>
    Re: Conversion of Excel file to Text file (Excession)
        Convert Symbl Ref to Hard Ref? (Sajjad Lateef)
    Re: Convert Symbl Ref to Hard Ref? (Andrew M. Langmead)
    Re: Cross platform 'distributed' perl? (Andrew M. Langmead)
    Re: Cross platform 'distributed' perl? (Mike Stok)
    Re: How to answer "is $this in @that"? <dformosa@st.nepean.uws.edu.au>
    Re: Is there a "Newsgroup" for Newbies to Perl? <ljz@asfast.com>
    Re: Is there a "Newsgroup" for Newbies to Perl? (I R A Aggie)
    Re: Ltrim at ASCII Zero. <grinch@whoville.com>
    Re: Munging addresses (was: Re: Perl Cgi Questions) (I R A Aggie)
    Re: rant: illiterate Perl programmers <serwep01@med.nyu.edu>
        Redirect on particular Browser  Functions scripts? rcwilk@dreamgate.com_Remove_to_mail
    Re: Someone put my munged e-mail address on a spam list <jdporter@min.net>
    Re: Starting long (background) jobs from CGI. Please he <beske@worldnet.att.net>
    Re: Starting long (background) jobs from CGI. Please he <frishman@mips.biochem.mpg.de>
    Re: Subscribing to a list without duplicates (Andrew M. Langmead)
    Re: Tying a blessed hash (was: Re: Tie/bless vs. bless/ <jdporter@min.net>
    Re: unpack vs. substr (was Re: Data Structure for Input (Jeffrey R. Drumm)
    Re: Using Pack "Creatively" (Jason Gloudon)
    Re: What does a reference refer to? <craig@mathworks.com>
    Re: Why $ENV{'PWD'} is not equal to `pwd` ? <craig@mathworks.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 3 Apr 1998 13:57:10 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: [SOURCE] rot90: New and better MIME format
Message-Id: <6g2prm$o82$1@news.ox.ac.uk>

In article <6g2f9l$lup$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@perl.com> wrote:
VVVVVVVVVVVVVVVVVVVVVVVVVVVVV       VVVVVVVVVVVVVVVVVVV
I s k m o f w t T c s p p p t       v t i r t t    -
  i e e w o a h h o h o o o h       e h n u h o    -
h n e s n r n e i o o p r p o       r i c n e p    t
a c p s   m t   s l u u t u s       t n l          o
v e s a i a   a     l l i l e       i k u t b a    m
e     g n t t c i t d a o a         c   d h o s 
  e s e v s o t s h   r n c w       a I e e t   
d v e s e     i   i b   s e h       l       t w 
e e n   n t g o a n e i   , o      >l s a l o e 
c r d i t h e n   g   n o        y >. h   i m l 
i y i n e a t   r   e   f l r         o w n   l 
d o n   d t   t e t x c   i e         u a e t ? 
e n g t     i o a h t e t k a       D l y s o   
d e   h   I n o l a r r h e d       o d         
    m e       . l t e t e               t f t   
t e e i     o   y   m a     t       y   o r h   
h l   r     n       e i     e       o     o e   
a s                 l n     x       u     m
t e                 y       t             


Now we need diff90 and patch90 so we can correct typos such as the
above more easily.

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger


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

Date: 03 Apr 1998 08:34:55 -0600
From: Quentin  Fennessy <quentin.fennessy@amd.com>
Subject: Re: [SOURCE] rot90: New and better MIME format
Message-Id: <ximafa33re8.fsf@shaddam.tx.amd>


Ouch ouch ouch ouch ouch.  I think I'd rather read text
using strings(1) on a Word document.  But I had to read it to the end.

Cool tool.

-- 
Quentin Fennessy			AMD, Austin Texas
Secret hacker rule #11 - hackers read manuals


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

Date: Fri, 3 Apr 1998 10:29:42 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: [SOURCE] rot90: New and better MIME format
Message-Id: <1d6wn2u.1l6e38g87505cN@slip166-72-108-19.ny.us.ibm.net>

Malcolm Beattie <mbeattie@sable.ox.ac.uk> wrote:

> In article <6g2f9l$lup$1@csnews.cs.colorado.edu>,
> Tom Christiansen <tchrist@perl.com> wrote:
> VVVVVVVVVVVVVVVVVVVVVVVVVVVVV       VVVVVVVVVVVVVVVVVVV
> I s k m o f w t T c s p p p t       v t i r t t    -
>   i e e w o a h h o h o o o h       e h n u h o    -
> h n e s n r n e i o o p r p o       r i c n e p    t
> a c p s   m t   s l u u t u s       t n l          o
> v e s a i a   a     l l i l e       i k u t b a    m
> e     g n t t c i t d a o a         c   d h o s 
>   e s e v s o t s h   r n c w       a I e e t   
> d v e s e     i   i b   s e h       l       t w 
> e e n   n t g o a n e i   , o      >l s a l o e 
> c r d i t h e n   g   n o        y >. h   i m l 
> i y i n e a t   r   e   f l r         o w n   l 
> d o n   d t   t e t x c   i e         u a e t ? 
> e n g t     i o a h t e t k a       D l y s o   
> d e   h   I n o l a r r h e d       o d         
>     m e       . l t e t e               t f t   
> t e e i     o   y   m a     t       y   o r h   
> h l   r     n       e i     e       o     o e   
> a s                 l n     x       u     m
> t e                 y       t             
> 
> 
> Now we need diff90 and patch90 so we can correct typos such as the
> above more easily.
> 
> --Malcolm

Well, here's "read90":

#!perl -w

@columns = map {chomp;$_} <>;

@grid = map {
  my $t = 0;
  [map {$t = !$t; $t ? $_ : ();} split //];  
} @columns;

undef @columns; # cleanup

$lines = 0;

foreach (@grid) {
  $lines = ($lines > @$_) ? $lines : @$_;
}

foreach (@grid) {
  my @temp = (" ") x $lines;
  splice @temp, 0, @$_, @$_;
  @$_ = @temp;
}

for ($l=0;$l<$lines;$l++) {
  $line = "";
  for ($c=0;$c<@grid;$c++) {
     $line .= $grid[$c][$l];
  }
  print "$line\n"
}
__END__

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Fri, 03 Apr 1998 13:38:56 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Anon Scalar Expression (was: Evaluate expression inside print "")
Message-Id: <3524E7A9.53CB@min.net>

Bart Lateur wrote:
> 
> Kevin Reid wrote:
> 
> >\($x,$y,$z) is equivalent to (\$x,\$y,\$z).
> 
> But apparently, only in a list context.
> 
> In a scalar context, it returns a SCALAR ref, and the comma's are
> interpreted as the comma operator. I think this code would be quite
> equivalent:
> 
>         do { my $result = ($x,$y,$z); \$result }

Now let's look at what's really going on here.
	\($x,$y,$z)
is equivalent to 
	(\$x,\$y,\$z)
in every case.  It is *not* dependent on context.

In other words, 

	$a = \($x,$y,$z);
is equivalent to 
	$a = (\$x,\$y,\$z);

and

	@b = \($x,$y,$z);
is equivalent to 
	@b = (\$x,\$y,\$z);

In each case, the comma is doing its usual thing.

hth,
John Porter


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

Date: Wed, 01 Apr 1998 23:20:56 -0500
From: Spider Boardman <spider@Orb.Nashua.NH.US>
Subject: Re: contexts: is there such a thing as array?
Message-Id: <35231227.167E@Orb.Nashua.NH.US>

Randal Schwartz wrote:
> So, once again, there CANNOT BE A LIST IN A SCALAR
> CONTEXT.  EVER.  WAKE UP AND SMELL THE COFFEE! :-)

Maybe.  If you can explain away this one:

	$a = @hash{'a','b','c','d'};

-- 
Spider Boardman (at home)			spider@Orb.Nashua.NH.US
The management (my cats) made me say this.	http://www.wp.com/spider
PGP public key fingerprint: 96 72 D2 C6 E0 92 32 89  F6 B2 C2 A0 1C AB
1F DC


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

Date: Fri, 03 Apr 1998 13:35:00 GMT
From: daclay@NOSPAMzip.com.au (Excession)
Subject: Re: Conversion of Excel file to Text file
Message-Id: <3524e503.7831045@news.zip.com.au>

 M Shakeel Qureshi <shakeel@ti.com> wrote:

>If it is possible to convert excel file to plain text file using perl.
>If yes then How ?

Not totally, however, there are some CPAN modules which will get you there
a bit:

>From OLE-Storage-0.385.tar.gz

herbert
   Converts simple MS Excel documents to HTML.

Hope this info helps.

Dac


---
David Andrew Clayton     # Please remove NO_SPAM when 
dac@NOSPAM.pcug.org.au   # sending email replies.
I post therefore I am.   #


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

Date: 3 Apr 1998 14:27:39 GMT
From: sajjad@uic.edu (Sajjad Lateef)
Subject: Convert Symbl Ref to Hard Ref?
Message-Id: <6g2rkr$2aec$1@piglet.cc.uic.edu>

Hi,
     Is there a way to convert a Symbolic Reference to a File to a hard
reference? 
     Background: I am using "use strict;" and it only allows the use of
hard references. (throws a fatal exception otherwise)

     I am using CGI.pm to process file uploads (enctype=multipart/form-data)
and it returns a variable that is not only a string (name of file on
the client machine) but is also a file reference (uploaded file on the server).
This variable is (AFAIK) a symbolic reference. 
     If possible, I would like to read the data from the uploaded file while
"use strict;" is in effect.
     I tried: @($file)  and also \$file but that didn't work. 

     Appreciate any suggestions.

Thanks,
Sajjad
sajjad <at> uic . edu
ps: This is not a cgi question per se ... hence, this post to c.l.p.m.


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

Date: Fri, 3 Apr 1998 15:50:49 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Convert Symbl Ref to Hard Ref?
Message-Id: <EquHCq.K35@world.std.com>

sajjad@uic.edu (Sajjad Lateef) writes:

>     Is there a way to convert a Symbolic Reference to a File to a hard
>reference? 

You could temporarily suspend the restriction of symbolic references,
dereference the symbolic ref, and make a hard reference of that.

{
  no strict 'refs';
  $hardref = \${$symbolicref};
}

-- 
Andrew Langmead


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

Date: Fri, 3 Apr 1998 13:54:55 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Cross platform 'distributed' perl?
Message-Id: <EquBzJ.Jy8@world.std.com>

les@MCS.COM (Leslie Mikesell) writes:

>Has anyone done a generic remote interface where a program on one
>host can hand a more or less arbitrary chunk of perl code to
>a server on another host and get back results from an 'eval'?
>I'm thinking in terms of a long-running server, probably with
>persistant connections from clients.  

Have you taken a look at Penguin?
<URL:http://www.oasis.leo.org/perl/exts/security/Penguin.dsc.html>

Also, how about the pRPC module?
<URL:http://www.perl.com/CPAN/modules/by-module/RPC/
pRPC-modules-0.1002.tar.gz>
-- 
Andrew Langmead


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

Date: 3 Apr 1998 14:15:47 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Cross platform 'distributed' perl?
Message-Id: <6g2quj$h7c@news-central.tiac.net>

In article <6g1baq$din$1@Venus.mcs.net>, Leslie Mikesell <les@MCS.COM> wrote:
>Has anyone done a generic remote interface where a program on one
>host can hand a more or less arbitrary chunk of perl code to
>a server on another host and get back results from an 'eval'?
>I'm thinking in terms of a long-running server, probably with
>persistant connections from clients.  Would it be better to just
>use mod_perl and http than to cobble up a way to return perl
>arrays and hashes?

You might want to look at the "Networking: Implementing RPC" chapter in
Srinivasan's _Advanced Perl Programming_ for some ideas. 

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 3 Apr 1998 12:54:15 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: How to answer "is $this in @that"?
Message-Id: <891608055.899377@cabal>

In <3522952a.0@news.ic.net> "Michael Kairys" <kairys@mi.sl.com> writes:

>There must be a simple way, but I haven't found it, to find out if a given
>scalar is in a list.

One method is to call grep in a scaler context like this,

$isin = grep {$this eq $_} @that;

However this is ineffent when you only wish to check its presnece and not
count the number of elerments.

A question for the more advanced per programer, do loop condtionals work
inside of grep and map?  If not why not?
--
I'm a perl programer if you need perl programing hire me. Buy easter bilbies.
Please excuse my spelling as I suffer from agraphia see the url. Support NoCeM
http://www.cit.nepean.uws.edu.au/~dformosa/Spelling.html  http://www.cm.org/ 
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: 03 Apr 1998 09:01:28 -0500
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <luhg4b2edj.fsf@asfast.com>

"Ben Coleman" <bcoleman@mindspring.com> writes:

> On 30 Mar 1998 10:59:53 -0500, Lloyd Zusman wrote:
> >However, how many experienced
> >programmers do you know of who read all available docs?
> 
> I'd say any _effective_ experienced programmers have at least gone
> through a period where they read everything they could get their
> hands on.  After you've been through that awhile, you get to a place
> where it's less necessary, as the experience reading all that doc
> allows you to grab a manual and quickly find the piece of info you're
> looking for.

Well, I've been programming since 1969, and I have to say that I have
rarely, if ever, read through all the docs about any languages and
systems I have learned about.  For me it has generally gone like this:

(1)  "Wow! A new language!"

(2)  Peruse the docs in a cursory fashion to get an overview.

(3)  Look at a few sample programs.

(4)  Begin to regularly scan through the relevant usenet newsgroup
     for pertinent material (I have only done this for the past 10
     years or so, before which I didn't have usenet access).

(5)  Try to code something.

(6)  Look up the relevant material in the docs if I get stuck.

(7)  Ask someone experienced if I am *really* stuck.

(8)  Go back to coding and repeat steps 6 and 7 as needed.

In general, I am fluent enough to code meaningful, useful programs
in a new language within a week using this approach.  If instead,
I were to read all the documentation first, it would be several
weeks before I even begin, given how bored I get reading technical
material without any hands-on experience.

For me these days, step 7 (above) is usually done very infrequently,
and as a last resort.  29 years ago when I was first learning
programming, however, I did it a bit more frequently.  Back then, I
learned pretty quickly that many of the people who were treated as
"gurus" in a given language tended to behave like arrogant jerks, but
there were plenty of other beginners or intermediate-level users of
the language in question who were more than happy to share knowledge
(in both directions).

One of my big realizations that happened fairly early in my career
(thankfully) occurred when I got to be pretty fluent in a computer
language (FORTRAN, back then) after a few months, and I found out that
I knew as much about it as the resident "guru" on my campus ... the
main difference being that I didn't *act* like a "guru".

> >How many
> >would laugh in your face if you tried to make this a "compulsory"
> >practice?
> 
> Far, far, too many.  The stats I've read about supposed technical
> professionals who _never_ read technical journals or books are
> frightening.

There's a difference between the *compulsory* reading of *all* the
documentation *before* even beginning to code (which is what the
original poster mentioned) and the perusal of some of the
documentation as needed or when interested.  The latter is what is
done by most programmers I have encountered.

As for those people who don't keep up with current information
concerning their chosen field, well, that's a different issue
altogether.

> >Many of us programmers read the docs as a last resort,
> >after we have tried hacking our way through a problem with no positive
> >results.
> 
> Which can mean that you waste a lot of time 'experimentally
> discovering' things that could have been much more quickly discovered
> by checking the docs.  And you may be leaving holes in your code in
> cases where there are side effects that aren't easily discoverable by
> hacking.

Not really.  After having had some experience programming, I found
that most languages were similar enough that at least 80 percent or
more of the pitfalls I could encounter in a new language were
generally things I knew about already from other languages I had
previously learned.  The remaining 20 percent were learned by
experimentive hacking, looking things up in the docs when necessary,
and asking a few questions here and there.

Furthermore, much of this 20 percent was often *not* covered very well
in the docs, and therefore, it had to be learned by trial and error
anyway.

> There's a place for experimental hacking where you feel the docs are
> less than clear, or that you don't yet understand the concepts, or
> where there's questions about the particular installation you're
> working with, but a policy of 'hack first, read later, if at all'
> seems counter-productive to me.

It depends on the person. My method (outlined above) is a variation on
that, and it has worked marvelously for me.

-- 
 Lloyd Zusman
 ljz@asfast.com


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

Date: Fri, 03 Apr 1998 09:49:24 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <fl_aggie-0304980949250001@aggie.coaps.fsu.edu>

In article <6g0ers$3b9@co-op.newsguy.com>, smitty77@pacbell.net wrote:

+ Believe it or not, James, there are some non-pompous people out there who are
+ more than willing to help out novices and others who are just looking for a
+ quick bit of help without having to pour through the immense FAQ which may or
+ may not answer the question thoroughly.

Since you find pouring thru an immense FAQ difficult, I present to you
some code that got posted here. I'm not the author, may whichever diety
you choose to worship bless that person. See the end of this post.

However, if it _is_ in the FAQ, it _is_ answered thoroughly. The FAQ
answers are about as close to perfection as any answers on USENET. They've
been looked at by tens of thousands of eyes, tested by G*d alone knows
how many people, and they've STOOD THE TEST OF TIME.

+ I know you wouldn't put yourself into
+ that category, and believe me, the novices would welcome your absense from the
+ group nearly as much as you would welcome their absense from this group.

Perhaps. Remember that hardass teacher you had in highschool, who 
worked you hard? I bet you do. Do you remember the ones that spoonfed
you? you don't? That's what I thought...

+ People
+ who are knowledgable in perl will go to this other newsgroup to both help and
+ ask questions.  What are you afraid of?  That you'll get bored without
all these
+ people to pick on?

If I wanted to pick 'em, I'd find them. Simple, eh? I don't want to pick
on 'em, I want them to understand HOW to find the answers for themselves.
Maybe someday their news server will be down, they'll have a deadline to
meet, and the only help they'll have is...some books, and the on-line
documentation and the FAQ. And that's it.

Or are you saying that you'll be providing 1-800-LUV-PERL phone support
for these instances??

Except I can come up with a situation where even _that_ isn't a viable
alternative: someone coding on a research vessel on a cruise.

Except maybe the person's on a deadline. The _last_ place I'd turn to
for help in those situations is USENET. You may not GET an answer in
a TIMELY fashion. If at all.

+ >They're gonna go looking for the wizards, and not people like
+ >themselves. I can see a situation that will lead to massive
+ >xposting, and possibly meta-flame wars.

+ Wizards?  James, you are an arrogant little guy.

Since I don't think your reading comprehension is that low, well, you're 
mighty brave in cyberspace, flameboy.

Followups...(and apologies to Scott Adams)

James

---- a FAQ question lister for all you people who whine and moan about
---- how terrible it is to search the FAQ...

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

# Q&D FAQ question lister

use strict;

for (@INC) {
  chdir $_ or next;
  chdir 'pod' or next;
  last if -f 'perlfaq.pod';
}
die "Couldn't find FAQ files in \@INC" unless -f _;

my $sep = "* " x 30;
opendir DIR, "." or die "Can't opendir: $!";
while (defined(my $item=readdir DIR)) {
  next unless $item =~ /perlfaq.?\.pod$/;
  unless (open FILE, "<$item") {
    warn "Can't open $item ($!), skipping"; next;
  }
  (my $fname = $item) =~ s/\.pod$//;
  print "$sep\n$fname\n$sep\n";   # header line
    while (<FILE>) {
      next unless s/^=head(\w+)\s+//;     # skip non-headers
        my $level = $1;
      next unless /[a-z]/;        # Skip all caps headers
        if ($level eq 1) {
          print "$fname: $_";
        } else {
          print "   $_";
        }
    }
}

__END__

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Fri, 3 Apr 1998 08:06:33 -0500
From: "Grinch" <grinch@whoville.com>
Subject: Re: Ltrim at ASCII Zero.
Message-Id: <6g2m4e$fem@fridge.shore.net>

Jean-Claude wrote in message <6g2lds$t9r@news.microsoft.com>...

>  _Accept_The_Task&_for_all_time
>
>I want to cut the contents from the point of the & (actually an ascii 0)
>leaving only what is to the left.    I tried a $x=~ tr\blah blah\ but don't
>know how to tell it to only cut at the ASCII zero.

\0 matches NULs. So, the following should do what you need, if I understand
you correctly that is:

$x =~ s/\0.*$//;

Caveat: This is from memory, which just hasn't been the same since the Pink
Floyd show a few years back.

HTH!

-grinch

--
"Of course coffee doesn't make the world go around. It
just makes it go faster." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: Fri, 03 Apr 1998 09:28:41 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Munging addresses (was: Re: Perl Cgi Questions)
Message-Id: <fl_aggie-0304980928410001@aggie.coaps.fsu.edu>

In article <35245044.E0B50F99@coos.dartmouth.edu>, rjk@coos.dartmouth.edu wrote:

+ 1.  Some people think munging addresses is worthwhile and should be allowed.
+ 
+ 2.  Some people think munging addresses is not worthwhile and should not
be allowed.

2b. Some people think posts with invalid headers --- including invalid
    from address should be cancelled on sight.

Followups...if y'all think this is topic is way off topic for this
newsgroup, USE YOUR FOLLOWUPS LINE!

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Fri, 03 Apr 1998 10:24:59 -0500
From: Peter Serwe <serwep01@med.nyu.edu>
Subject: Re: rant: illiterate Perl programmers
Message-Id: <3524FF4B.BD4EA70F@med.nyu.edu>

Kyler Laird wrote:
 
> As for contributing to the community...I will
> send a free Perl programmer's grammar
> enhancement device to the first 10 people who
> send me their USPS addresses.  (It's hardware.)
> 
> --kyler


What, a copy of Webster's?

-- 
Peter


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

Date: Fri, 03 Apr 1998 15:37:01 GMT
From: rcwilk@dreamgate.com_Remove_to_mail
Subject: Redirect on particular Browser  Functions scripts?
Message-Id: <3525014c.1479755@nntp.best.com>

Hi,

 I'm looking for the latest (last six months) in redirection scripts.

 I'd especially like one that took the versions of the browsers into
account and grouped them by ability rather than type
 I'm fine with IE 4 and  Netscape 4 going to the same place,
but not Netscape 4 and netsacpe 2.

 - Richard


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

Date: Fri, 03 Apr 1998 15:35:34 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Someone put my munged e-mail address on a spam list
Message-Id: <35250336.7908@min.net>

John Stanley wrote:
> 
> In article <3523AC0A.590A@min.net>, John Porter  <jdporter@min.net> wrote:
> >John Stanley wrote:
> >>
> >> In article <3522e7fd.3383874@news.tornado.be>,
> >> Bart Lateur <bart.mediamind@tornado.be> wrote:
> >> >
> >> >It hardly costs any time to the spammer, since it's a fully automated
> >> >process.
> >>
> >> Yes, it is automated, and if the automaton is busy trying to send mail
> >> to a bogus address it is 1) not sending it to a real address, perhaps
> >> yours, and 2) wasting time. Since the automaton belongs to the spammer,
> >> the waste belongs to the spammer, too.
> >
> >Bogus argument, John.  Any program which sends spam can send it to
> >thousands (o.k, hundreds) of addresses per second,
> 
> I didn't say it was a HUGE waste of time, but even .01 second is a
> waste. Then consider if just 1000 addresses were munged. That's 10
> seconds. The real numbers are much greater, so the time is much
> greater.

The point is, the time is irrelevant.  Maybe I'm way off base here,
but the scenario I envision is this: the spammer has a database of
thousands of addresses.  He kicks off a process which sends a
message to each one.  He might then go to bed, or go to work, or
go play golf, or twiddle his thumbs.  Whether the process finishes
in two minutes or ten minutes is really irrelevant.

> >and it does not
> >know the difference between a good address and a bad one.  In fact
> 
> I didn't say it did, nor does the argument depend on it. It is a waste
> of the automaton's time whether it knows the address is invalid or not.

Hmm, from the spammer's perspective, I doubt that's true: time spent
sending to a valid address is not time wasted.

Now you could argue that almost all spam-time is wasted, since almost
no one responds favorably to it when they get it.  But spamming is
marketing, and the spammers probably think they're doing well if they
get even one bite.  So in that sense, NO spam-time is wasted, if
they get any bites.

> >In case you haven't noticed, spammers never respond to any message
> >sent to the address they send from.
> 
> So what? The fact they don't respond means it wasn't a waste of time to
> send mail to a munged address?

I was looking at the ways in which bad email addresses might cause a
spammer to incur cost; and pointing out that the effect of bounced
mail (or even legitimate replies) doesn't.

I suppose it's all a matter of scale.  If a spammer stores and sends
to millions of addresses, the vast majority of which are bogus,
then one could argue that the extra $100 he paid for the 6-gig disk
was a waste, and the extra cent he pays in electric bills, because 
his system was working a teeny bit harder, was a waste.  But this
is an extremely lame argument.  Far more relevant is that the 
spammer buys the disk which is much larger than he'll ever need,
so there is no "cost" of storage for bogus vs. valid addresses;
his machine is running all the time, or at least far longer than 
it takes to send to all those addresses, so there is no "cost" of 
running the spam program; the cost of connection to the internet is 
a flat monthly fee, so there is no "cost" of sending to bogus vs.
valid addresses...

If (when?) the spammer has a list of 18 godzillion addresses, 
approximately half of which are bogus, and he can only send
to 9 godzillion addresses in a week, then maybe it will pay off
for him to worry about which addresses are valid and which aren't.
But as it stands now, it would actually be *more* costly for him
to worry about that, than to just send to every address he can get
his grubby little hands on.


> >> Did I really need to specify that the spammer himself wasn't wasting
> >> his time but his system was?
> >
> >No, but the fact undermines your argument.  CPU cycles are cheap.
> 
> But not free. Were they free, there would be no purpose in encrypting
> anything.

Your email:decryption analogy is invalid.  For sending email,
cpu cycles are essentially free (for the spammer, anyway).


> If the spam does not cause a cost to the recipient, then address
> munging is effective. The fact that it also increases the costs to the
> spammer is an incidental benefit.

That's easy for us to say, who never have to worry about the vast
majority of the expense of running the internet.  As it is, we're
freeloading on the big companies for whom the internet is vital
medium of business.  As spammers step up their efforts, the
capabilities of the internet are strained, and the costs to those
who build and maintain the internet increase; sooner or later
those costs trickle down to each one of us.  And that is independent
of whether your ISP can stick that message in your mailbox.

John Porter


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

Date: Fri, 03 Apr 1998 09:32:50 -0500
From: Bryan Beske <beske@worldnet.att.net>
Subject: Re: Starting long (background) jobs from CGI. Please help!
Message-Id: <6g2ruh$nvq@bgtnsc03.worldnet.att.net>

Try the following:

        open( FOO, "| the_long_program.pl &" );
        close(FOO);

        print "<H1>Thank you, the job has been started....\n";

The pipe will open and start the process and the close will terminate you
program without killing the one the pipe opened.

Works fine on my Linux box.

b^2



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

Date: Fri, 03 Apr 1998 17:39:13 +0200
From: Dmitrij Frishman <frishman@mips.biochem.mpg.de>
Subject: Re: Starting long (background) jobs from CGI. Please help!
Message-Id: <352502A1.2781@mips.biochem.mpg.de>

Dear Bryan,

> Try the following:
> 
>         open( FOO, "| the_long_program.pl &" );
>         close(FOO);
> 
>         print "<H1>Thank you, the job has been started....\n";
> 

On my DIGITAL UNIX box I had to modify the above in the following way:

open( FOO, "| the_long_program.pl >>/dev/null &" );
close(FOO);

and it worked just fine.

Many thanks for your help. You virtually saved me!

Best regards,

Dmitrij


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

Date: Fri, 3 Apr 1998 15:13:32 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Subscribing to a list without duplicates
Message-Id: <EquFMK.Crp@world.std.com>

rodb(remove)@dial.pipex.com (Rod Borland) writes:

>Can anyone help me? I am using perl to create a list of subscribers
>and the program I downloaded to do it allows people to subscribe
>multiple times which is a real pain - like this:

I have a couple of ideas.

You could use the code as it exists, and then filter out the
duplicates before you send whatever it is you are sending.

You you could use a hash tied to the database to store the
subscribers, then identical email address would just overwrite the
previous key.

You should be aware of the fact that you are missing any form of file
locking to prevent simultaneous access to the file. If the code is run
from two processes simultaneously, it could damaage your data. You
might want to look at:
<URL:http://www.stonehenge.com/merlyn/WebTechniques/col04.html> for
details on locking.

You might want to get a version of perl that runs on your own
computer, so you can test scripts before running them on your
server. Running "perl -c scriptname" on a script is a more productive
method of finding simple syntax error than posting the code to Usenet
and having others run it for you.

Look for a missing semicolon and make sure your curly brackets match.

-- 
Andrew Langmead


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

Date: Fri, 03 Apr 1998 14:37:02 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Tying a blessed hash (was: Re: Tie/bless vs. bless/tie and segmentation fault)
Message-Id: <3524F582.631C@min.net>

Well I'll be gosh darned.

use Foo;
my $obj = new Foo;
$obj->{name} = 'john';

The client's object, $obj, is a blessed hash-ref.
But the object in the STORE method ($self) is a
blessed array-ref.

I have to say, I'm not sure I'd build a large system
dependent on this behavior.

So, how do the two objects communicate?  Do you have
a field in the hash which refs the array? And vv?

John Porter


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

Date: Fri, 03 Apr 1998 13:59:45 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: unpack vs. substr (was Re: Data Structure for Input File)
Message-Id: <3525d70e.157630400@news.mmc.org>

On Thu, 02 Apr 1998 22:38:53 -0500, Ronald J Kimball <rjk@coos.dartmouth.edu>
wrote:

>Clinton Bodine wrote:
>> 
>> You were right, it wasn't fair.... but it did emphasize an important point
>> in my program.  If I use substr, I can pick and choose which fields I want
>> very easily.  If I use unpack, I'm going to have to read the entire record
>> and then pick and choose.
>
>I don't know if you would count this as reading the entire record, but you can
>use the x specifier to skip fields you don't want:
>
(snip)

But there's still a significant speed issue.

Let's try really comparing apples to apples. I always _assumed_ that unpack
would be faster than substr, especially when fetching multiple segments from a
scalar. Turns out that ain't the case at all:

#!/usr/bin/perl -w

use strict;
use vars qw($var @arr $aye $bee $see);

use Benchmark;

$var = 'X' x 50;
my $iter = 500000;

timethese
    (
     $iter,
     {
      'Unpck2Arry' => sub 
      {
	  @arr = unpack "A10x8A6x20A6",$var
      },
      'Unpck2List' => sub 
      {
	  ($aye,$bee,$see) = unpack "A10x8A6x20A6",$var
      },
      'Sbstr2Arry' => sub 
      {
	  @arr = (substr($var,0,10),
		  substr($var,18,6),
		  substr($var,44,6))
      },
      'Sbstr2List' => sub 
      {
	  ($aye,$bee,$see) = (substr($var,0,10),
			      substr($var,18,6),
			      substr($var,44,6))
      },
      'Sbstr2Elem' => sub
      {
	  $arr[0] = substr($var,0,10);
	  $arr[1] = substr($var,18,6);
	  $arr[2] = substr($var,44,6)
      },
      'Sbstr2Sclr' => sub
      {
	  $aye = substr($var,0,10);
	  $bee = substr($var,18,6);
	  $see = substr($var,44,6)
      }
     }
    );

__END__  

Sbstr2Arry: 20 secs (19.99 usr  0.02 sys = 20.01 cpu)
Sbstr2Elem: 10 secs ( 9.54 usr  0.01 sys =  9.55 cpu)
Sbstr2List: 17 secs (17.25 usr  0.02 sys = 17.27 cpu)
Sbstr2Sclr:  6 secs ( 6.99 usr  0.00 sys =  6.99 cpu)
Unpck2Arry: 21 secs (20.61 usr  0.02 sys = 20.63 cpu)
Unpck2List: 16 secs (16.12 usr  0.02 sys = 16.14 cpu)

Like, wow. Guess I'll stick to unpacking stuff that really _needs_ to be
unpacked.

Am I the only one surprised by these results?

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Fri, 03 Apr 1998 15:57:13 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Using Pack "Creatively"
Message-Id: <slrn6ia1hp.91s.jgloudon@manitoba.bbn.com>

ivanovic@cs.monash.edu.au <ivanovic@cs.monash.edu.au> wrote:
>This may be a dumb question, but does anyone out there know how to >simply
>and easily< Pack/Unpack a numerical variable (e.g. the number 500) into an N
>bit binary structure (e.g. 16 bits).

N would be handled by with 0's if you are dealing with strictly unsigned 
numbers.

>I do not want to use (i) pack "c", 500 (gives an 8 bit structure) nor do I
>want to use (ii) pack "s", 500 (gives a 32 bit structure)... I want to use
>pack and encode it into, say, a 16 bit structure, or more generally an N bit
>structure.

Have you really looked at the examples - in the perlfunc manpage:

    $foo = pack("s2",1,2);
    # "\1\0\2\0" on little-endian
    # "\0\1\0\2" on big-endian

If these don't work then your perl install is broken.
What compiler and operating system are you using?

>By the way, (pack "c2", 500) does NOT work - I tried.

It should not. But "C2", (500 / 16), (500 % 16), might depending on your
byte endianess.

-- 
Jason Gloudon


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

Date: Fri, 03 Apr 1998 08:29:20 -0500
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: What does a reference refer to?
Message-Id: <3524E430.417D29D9@mathworks.com>

You can also just print the variable in the debugger.  This not only gives you
the reference type but the address in memory.

Craig

Grinch wrote:

> R. Allen Conway wrote in message
>
> <14953E9BAF17D111926800805FA66B7102F01A69@hermes.atos-group.com>...
> >How can you tell what a reference is referring to - a hash, an array, a
> >whatever?
>
> Use the "ref" function. It takes a single argument, and returns a null
> string if the argument is not a reference.
>
> If the argument is a reference to a built-in data type, it returns REF,
> SCALAR, ARRAY, HASH, CODE, or GLOB as appropriate. If the referenced object
> has been blessed into a package, then the name of the package is returned.
>
> HTH!
>
> -grinch
>
> --
> "Of course coffee doesn't make the world go around. It
> just makes it go faster." - me
>
> Sherm Pendley
> grinch@whoville.com
> http://www.whoville.com





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

Date: Fri, 03 Apr 1998 08:49:32 -0500
From: Craig Ciquera <craig@mathworks.com>
To: James_Yang@via.com.tw
Subject: Re: Why $ENV{'PWD'} is not equal to `pwd` ?
Message-Id: <3524E8EC.F1A27D58@mathworks.com>

Hi,

The answer lies in the fave that PWD1 = PWD3.

The %ENV hash is your environment not perl's environment.

Craig

James Yang wrote:

> Hi,
>
> The followings are part of my Perl script,
>
> $pwd1 = $ENV{'PWD'};
> $pwd2 = `pwd`;
> $pwd3 = `env | grep PWD`;
> print "PWD1 $pwd1\n";
> print "PWD2 $pwd2\n";
> print "PWD3 $pwd3\n";
>
> And if I run this program by use of a makefile like this:
> ### makefile ###
> test:
>     cd dir1; MyProg;
>
> Then the stand output will show as below:
>
> cd dir1; MyProg;
> PWD1    /usr/bauli
> PWD2    /usr/bauli/dir1
> >
>
> Is there anybody can tell me what is the reason that PWD1 is not equal
> to PWD2?
> Thanks a lot!
>
> Bauli





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

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

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