[13165] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 575 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 18 13:07:24 1999

Date: Wed, 18 Aug 1999 10:05:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 18 Aug 1999     Volume: 9 Number: 575

Today's topics:
    Re: $$var[xxx] vs ${var}[xxx] <alex@kawo2.rwth-aachen.de>
    Re: $$var[xxx] vs ${var}[xxx] (Randal L. Schwartz)
    Re: $$var[xxx] vs ${var}[xxx] <aperrin@mcmahon.qal.berkeley.edu>
    Re: A prime numbers program. (Anno Siegel)
        arithmetic right bit shift <Mark_Reibert-SC2762@email.mot.com>
        cgi POST in Perl script? djnaab@students.wisc.edu
        Creating perl reports <isspecial@fast.net>
    Re: current dir in perl ? (Bill Moseley)
    Re: current dir in perl ? (David Pashley)
    Re: eliminate ',' from a data set... (Larry Rosler)
        How To change directories <yesnaud@fdgroup.co.uk>
    Re: How To change directories (Bill Moseley)
        How to wait for a process to finish... <yesnaud@fdgroup.co.uk>
        Matt's cookielib and Unicode <lebed@my-deja.com>
    Re: Matt's cookielib and Unicode <bn711@freenet.carleton.ca>
    Re: Numeric Formatting (Gary O'Keefe)
        O'Reilly Online Training support@gethits.com
        Problem w/subroutine using TokeParser <Pan@LA-Online.com>
    Re: Problems with acos?? (Larry Rosler)
        pushing an anonymous hash slice (Bill Moseley)
        someone pleae help <cerna@cig.mot.com>
    Re: statistical sorts <malcolm.dewjones@moh.hnet.bc.ca>
    Re: Strange Error (Larry Rosler)
    Re: Wacky Programming Tales <bogw@geo.vu.nl>
    Re: Wacky Programming Tales (Roy Smith)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 18 Aug 1999 18:12:13 +0200
From: Alex Farber <alex@kawo2.rwth-aachen.de>
To: "Irwin M. Feuerstein" <ebct@hotmail.com>
Subject: Re: $$var[xxx] vs ${var}[xxx]
Message-Id: <37BADB5D.7235A9A4@kawo2.rwth-aachen.de>

Hi Irwin,

"Irwin M. Feuerstein" wrote:
> I've read the pages, and I still don't get it. Can someone please tell me
> (in very simple terms, please) what the difference is amongst:
> 
> $$var[xxx]
> ${$var}[xxx]
> $${var}[xxx]
> ${${var}}[xxx]

there is a good explanation available at
http://www.oreilly.com/catalog/advperl/excerpt/ch01.html

Regards
Alex

-- 
Ich studiere  Elektrotechnik (Technische  Informatik) an der RWTH Aachen
und bin ein guter Perl-Programmierer (arbeite seit 4 Jahren als Intranet-
Entwickler). Kann auch C, Java, SQL, JavaScript und HTML, CGI und TCP/IP.
Ich suche eine gut bezahlte  Diplomstelle in Koeln, Aachen oder Umgebung.


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

Date: 18 Aug 1999 09:33:45 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: $$var[xxx] vs ${var}[xxx]
Message-Id: <m1vhadoxp2.fsf@halfdome.holdit.com>

>>>>> "Jon" == Jon Peterson <jpeterson@office.colt.net> writes:

>> $$var[xxx]

Jon> The thingy that $var[xxx] is a reference to. @var is an array. $var[xxx] is a
Jon> particular element of @var, which we assume here contains a reference.
Jon> $$var[xxx] the thing (a scalar thing) that that reference refers to.

No.  It's the same as the one below.  $$var[xxx] is the same as
${$var}[xxx] and $var->[xxx].  You might be thinking of ${$var[xxx]}
instead, which is a different construct and requires those braces.

>> $${var}[xxx]

Jon> Ouch :-). The brackets are redundant here, and rather confusing. This is the
Jon> same as $$var[xxx].

Correct, although you probably would have incorrectly parsed *that* as
${$var[xxx]}. :)

print [qw(Just another Perl hacker,)]->[$_]," " for 0..3

-- 
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: Wed, 18 Aug 1999 09:21:30 -0700
From: Andrew J Perrin <aperrin@mcmahon.qal.berkeley.edu>
Subject: Re: $$var[xxx] vs ${var}[xxx]
Message-Id: <37BADD8A.C1326E41@mcmahon.qal.berkeley.edu>

Jason Reed wrote:
> 
> Jon Peterson <jpeterson@office.colt.net> writes:
> 

> What?
> 
> bash$ perl -w
> $var = ['foo', 'bar', 'baz', 'mumble'];
> print $$var[3], "\n";
> __END__
> mumble
> bash$
> 
> I see no @var here.
> 

True enough - just @$var:

$var = ['foo', 'bar', 'baz', 'mumble'];
print ref($var), "\n";
print $$var[3], "\n";

ARRAY
mumble


-- 
-------------------------------------------------------------
Andrew Perrin - NT/Unix/Access Consulting
aperrin@mcmahon.qal.berkeley.edu  
http://www.geocities.com/SiliconValley/Grid/7544/


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

Date: 18 Aug 1999 16:20:11 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: A prime numbers program.
Message-Id: <7pemfr$6cj$1@lublin.zrz.tu-berlin.de>

 <jm_the_great@my-deja.com> wrote in comp.lang.perl.misc:
>     This is a little program that will figure out all the prime
>numbers from $ARGV[1] to $ARGV[2].  $ARGV[0] is the filename for the
>output and $ARGV[3] is if you want to see the numbers as they go by
>(note: just put anything down for $ARGV[3]).
>     I just want to see if anybody can help me make this thing faster
>(Although, it does run about 20% faster on my Linux box then my Windows
>box :-).  The code is here (also, if somebody wants to put some
>comments in it, that would be great):
>
>#!/usr/bin/perl

Use -w.  Use strict.

># By Justin Mitchell
># If you have any comments/suggestions e-mail
># them to me at jm_777_homeboy@yahoo.com
>
>$n = 1;
>$primes[1] = 2;
>$c = 0;
>@digits = ($ARGV[1]..$ARGV[2]);
>foreach $number (@digits){
>    $pr = 0;
>    if (($number / 2)==(int($number / 2))){

Test for divisibility using the % (modulus) operator.

>	next;
>        }
>    for ($digi = 2; ($digi**2) <= $number; $digi++){

You have tested for 2 separately.  Why test again?  Start at 3
and step through the test divisors in steps of 2.

>	$digi++ if (($digi / 2)==(int($digi / 2)));
>        if (($number / $digi)==(int($number / $digi))){
>	    $pr = 1;
>	    last;
>	    }
>        }
>    if ($pr == 0){
>	$n++;
>	$primes[$n] = $number;
>	print "$number\n" if ($ARGV[3])
>        }
>    }
>open (OUTFILE, ">$ARGV[0]");
>select (OUTFILE);
>print "Found $n primes";
>foreach $prime (@primes){
>    print "$prime\n";
>    }
>close (OUTFILE);

Since you collect primes anyway, it may pay to reorganize things so that
you know all primes < $number when you test for $number.  You can then
use the known primes as test divisors.

Anno


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

Date: Wed, 18 Aug 1999 09:45:58 -0700
From: "Dr. Mark S. Reibert" <Mark_Reibert-SC2762@email.mot.com>
Subject: arithmetic right bit shift
Message-Id: <37BAE346.5FF7005@email.mot.com>

Does anyone know where Perl's arithmetic right bit shift went?

In Perl version <= 5.003 the right shift is defined (in pp.c) as:

PP(pp_right_shift)
{
    dSP; dATARGET; tryAMAGICbin(rshift,opASSIGN); 
    {
      dPOPTOPiirl;
      SETi( left >> right );
      RETURN;
    }
}

This does an INTEGER right bit shift, which when Perl is compiled with gcc
(or any other C compiler that implements its right shift as arithmetic)
gets you an arithmetic shift. On the other hand, for Perl version >= 5.004,
the right shift is implemented (once again from pp.c) as:

PP(pp_right_shift)
{
    djSP; dATARGET; tryAMAGICbin(rshift,opASSIGN);
    {
      IBW shift = POPi;
      if (PL_op->op_private & HINT_INTEGER) {
	IBW i = TOPi;
	i = BWi(i) >> shift;
	SETi(BWi(i));
      }
      else {
	UBW u = TOPu;
	u >>= shift;
	SETu(BWu(u));
      }
      RETURN;
    }
}

In this case HINT_INTEGER is #define'd (perl.h) as 0x00000001. I can't seem
to generate a case where PL_op->op_private is nonzero, therefore the right
shift falls through to the unsigned case and we get (by the ANSI C
criteria) a logical shift!

Any insight?

Thanks,
Mark Reibert

-- 

 ------------------------------
Mark S. Reibert, Ph.D.
Motorola SSTG (Datasoft Corp.)
Tel: 480-732-3752
Page: 800-759-8352 #7689193
Mail: sc2762@email.mot.com
 ------------------------------


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

Date: Wed, 18 Aug 1999 16:26:49 GMT
From: djnaab@students.wisc.edu
Subject: cgi POST in Perl script?
Message-Id: <7pemrp$5j9$1@nnrp1.deja.com>

I'm writing a script which needs to be able to POST a few variables to
a script on an external server.  I assume that there is a function for
this in cgi-lib (or the like), but I can't find it anywhere.  It is
important that this is done from the server (therefore the script
itself), not the client.  Is this possible?

Thanks in advance,

Dan


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 18 Aug 1999 16:09:40 GMT
From: Bill <isspecial@fast.net>
Subject: Creating perl reports
Message-Id: <7pelrp$4mv$1@nnrp1.deja.com>

I'm new to perl programming and was wondering if there is any utility
or package out there to allow me to design a perl report using a
WYSIWYG interface.  I need to develope perl code that can access a
MYSQL database and build a report page or pages that can be directly
viewed on the company web site and look like the current paper reports
we already generate.  I'm sure it can be done but I'm getting a bit
overwhelmed with the code itself and if I could generate most of the
report code with a utility and then tweek it to use my database it
would certainly speed up the process.  So if anyone could give me a
boot in the right direction I would really appreciate it.
Thanks


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 18 Aug 1999 09:09:10 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: current dir in perl ?
Message-Id: <MPG.12247a83e835c2e79896c1@nntp1.ba.best.com>

Marcel Grunauer (marcel.grunauer@lovely.net) seems to say...
> On Wed, 18 Aug 1999 07:04:42 -0700, moseley@best.com (Bill Moseley)
> wrote:
> 
> >David Pashley (cszdp@cslin002.leeds.ac.uk) seems to say...
> >> The problem you have is that perl only looks in directories in @INC for
> >> modules. @INC doesn't normally contain the current working directory.
> >
> >Is that true?  I thought that was only true when run under -T
> 
> -T turns on tainting checks.

Right.  (See above for context)

Look at this:

BASH.EXE-2.02$ perl -Mfoo
Can't locate foo.pm in @INC 
(@INC contains: :/perl5/lib C:/perl5/site/lib .).
BEGIN failed--compilation aborted.

BASH.EXE-2.02$ perl -TMfoo
Can't locate foo.pm in @INC 
(@INC contains: C:/perl5/lib C:/perl5/site/lib).
BEGIN failed--compilation aborted.

See the difference?




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


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

Date: Wed, 18 Aug 1999 17:27:23 +0100 (BST)
From: cszdp@cslin003.leeds.ac.uk (David Pashley)
Subject: Re: current dir in perl ?
Message-Id: <1999Aug18.162723.24339@leeds.ac.uk>

Bill Moseley's words, in praise for the llamas, were:
> David Pashley (cszdp@cslin002.leeds.ac.uk) seems to say...
> > The problem you have is that perl only looks in directories in @INC for
> > modules. @INC doesn't normally contain the current working directory.
> 
> Is that true?  I thought that was only true when run under -T

Okay, I should have looked first. It is in @INC unless you have the -T
option. 

cslin003% perl -wT -e 'print join "\n",@INC,"\n"'
/usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005

cslin003% perl -w -e 'print join "\n",@INC,"\n"'
/usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005
 .

As for the problem at hand: Just a thought. If you ran
c:\scripts\script.pl from c:\, would the script's cwd be c:\ or
c:\scripts?  If it was c:\ that could explain it. Still it can't hurt to
have use lib at the top.

-- 
David Pashley
david@davidpashley.com
http://www.davidpashley.com
Now he understood - "If it ain't broken, don't fix it"


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

Date: Wed, 18 Aug 1999 09:53:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: eliminate ',' from a data set...
Message-Id: <MPG.122484c43e8206f9989e6e@nntp.hpl.hp.com>

In article <7peku8$jct$1@info2.uah.edu> on 18 Aug 1999 15:53:44 GMT, 
Greg Bacon <gbacon@itsc.uah.edu> says...
> In article <7pej26$36b$1@cfs2.kis.keele.ac.uk>,
> 	"Andrew Weller" <p8e77@keele.ac.uk> writes:
> : I am reading in a data set in the form:
> : 
> : X Y Z,
> : X Y Z,
> : 
> : Unfortunately it is also reading in the ',' (comma) in the final
> : field - when I perform a calculation on this Z value it screws up
> : (obviously)!! Is there any way to loop around and eliminate the ','
> : (comma) before performing calculations??
> 
>     while (<>) {
>         s/,\s*$//;
> 
>         my($x,$y,$z) = split;
> 
>         ...;
>     }

How about all in one line, without the substitution:

          my ($x, $y, $z) = split /,|\s+/;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 18 Aug 1999 17:27:17 +0100
From: "Yoann Esnaud" <yesnaud@fdgroup.co.uk>
Subject: How To change directories
Message-Id: <7pemtu$cci$1@news1.cableinet.co.uk>

Hi,

(Win 95 - PC, Perl 5)

I am creating a perl script and I would like to run an application but with
a different working directory as the one I am executing the perl script
from, any ideas how to do this? (I tried to use chroot, but it does not seem
to work)

Thanks.






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

Date: Wed, 18 Aug 1999 09:37:12 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: How To change directories
Message-Id: <MPG.12248110e0f501d19896c3@nntp1.ba.best.com>

Yoann Esnaud (yesnaud@fdgroup.co.uk) seems to say...
> (Win 95 - PC, Perl 5)
Not really the issue.

> I am creating a perl script and I would like to run an application but with
> a different working directory as the one I am executing the perl script
> from...

What do you want.  To run a program in another directory or to change 
directories?

perldoc -f chdir

or look at setting you path in %ENV

or look at pre-pending the path to the program you want to run (probably 
best).

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


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

Date: Wed, 18 Aug 1999 17:30:13 +0100
From: "Yoann Esnaud" <yesnaud@fdgroup.co.uk>
Subject: How to wait for a process to finish...
Message-Id: <7pen3e$cem$1@news1.cableinet.co.uk>

Hi,

(Perl 5, PC Win 95)

I am trying to re-generate a whole stack of forms that we have developed in
forms. So I decided to create a perl script to do this. The only problem is
that when I am generating a form, the perl script does not wait for the form
to finish and start to generate another, obviously after a while the pc lack
of memory and crashes.

Under NT I use $], if I set this to 1 then it will wait for the process to
be finish before starting another. My question is, how do I do this under
Windows 95?

Thanks




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

Date: Wed, 18 Aug 1999 16:11:50 GMT
From: Steve <lebed@my-deja.com>
Subject: Matt's cookielib and Unicode
Message-Id: <7pelvq$4pq$1@nnrp1.deja.com>

I've got cookielib from Matt'sScript Archive and it can't handle
Unicode characters. In Javascript you simply call decode and it
converts to plain text, but there doesn't seem to be an easy way to do
it in Perl. Am I wrong? I tried lifting the code out of FormMail which
does it, but it produced the wrong characters.

Surely this isn't difficult, but I've only been learning Perl for 2
days, and you never need to learn languages anyway, you just copy code.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 18 Aug 1999 16:57:19 GMT
From: David Huggins-Daines <bn711@freenet.carleton.ca>
Subject: Re: Matt's cookielib and Unicode
Message-Id: <87g11h2fio.fsf@eradicator.dhis.org>

Steve <lebed@my-deja.com> writes:

> I've got cookielib from Matt'sScript Archive and it can't handle
> Unicode characters.

That's a new one :)

In any case, Unicode probably wasn't on the horizon when those scripts
were written, so we can't entirely blame them. 

> In Javascript you simply call decode and it converts to plain text

Go find the Unicode::String and Unicode::Map8 modules on CPAN (er,
http://www.perl.com/CPAN/modules/by-module/Unicode/), and read the
docs - they will show you the way.

Next version of Perl will have Unicode support built in.

BTW, it's a generally accepted fact that learning Perl via Matt's
Scripts is a bad idea :)

-- 
You do{} stuff.  Then it's $done.  Then you die().


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

Date: Wed, 18 Aug 1999 16:21:05 GMT
From: gary@onegoodidea.com (Gary O'Keefe)
Subject: Re: Numeric Formatting
Message-Id: <37badc63.28557370@news.hydro.co.uk>

A keyboard was whacked upside Gary O'Keefe's head and out came:


>The trick is to use printf() to format the output. If you're on a unix
>box then you might want to look at the formats(5) manual ('man -s 5
>foramts') page to get an idea of the versatility of printf.

Typo, should be 'man -s 5 formats'. Doh!

Gary
--
Gary O'Keefe
gary@onegoodidea.com

You know the score - my current employer has nothing to do with what I post


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

Date: Wed, 18 Aug 1999 16:28:42 GMT
From: support@gethits.com
Subject: O'Reilly Online Training
Message-Id: <37BAE0DC.70BFCEAE@gethits.com>

The net needs some good online Perl courses...
I've been taking an online course called  "Programming Perl 
With Databases" at http://training.oreilly.com
If anyone is considering taking this course, you may
do better simply reading O'Reilly's books. 

For $249 you get: 15 sections of understandable and well
written lessons which take about 20 min. each to read; 
assignments at the end of each section for which there 
are no answers and no instructor to reveiw; no instructor
access at all; beautiful (really beautiful) graphics for
words like "CGI" and "Perl"; shockwave showing a basic
client-server communication process; real audio to explain
the shockwave and which is a verbatim repitition of the
paragraph above the shockwave; real audio at the beginning
of each section which is  a verbatim repetition of
a couple paragraphs; good reading references from required
and supplementary resources; an online student forum (webboard)
for which there are no posts (current or in history) for this 
and the other perl course; no instructor or course admin. 
access.

I hope it doesn't look like I'm slamming this course or 
O'Reilly...this is simply what it is like. The fee is high
for what you get. For $7.95 a month, zdu.com has some basic
instructor led perl courses (which I haven't taken) and
about 15 great self directed perl tutorials covering a
wide variety of topics (most of which I have taken and are
valuable). 

Attn. Randall Schwartz and Tom Christian: the net needs some 
serious online perl courses. Mr. Schwartz: I would love to take 
you "PROM" course, but Portland is a bit of a commute! I 
would gladly push $249 your way for an instructor interactive
course.

IMHO. Darryl Dyck.


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

Date: Wed, 18 Aug 1999 09:14:51 -0700
From: Pan <Pan@LA-Online.com>
Subject: Problem w/subroutine using TokeParser
Message-Id: <37BADBFB.DE23D353@LA-Online.com>

I have written a program that extracts links from various newspapers on
a daily basis and outputs them in HTML format.  One of the sets of links
does not give very descriptive comments between <A> and</A>, and I would
like to output some text from the article that this set links to.

To do this, I wrote a subroutine that receives part of a valid URL
($linkURL) as an argument, and which is supposed to open the page
associated with the URL, parse text after the first instance of a <P>
tag until it hits a </font> tag, pull a substring and print it.  The
program does not crash, so I assume that the syntax is valid.  However,
it does not print any data, and the subroutine that it is called from
quits after the first iteration (it should step through 4 times based on
today's input). 

To see a working model of the program without the subroutine go to

http://www.abendgallery.com/cgi-bin/bronconews

To see what happens when I call the subroutine, go here:

http://www.abendgallery.com/cgi-bin/broncone.cgi

sub get_text{
      #parse pages for some text
$storyURL="<A HREF=http://www.foo.com/foo/"."$linkURL".">";
      $webPage=get($storyURL);
      $parser=HTML::TokeParser->new(\$webPage);
       my $token = $parser->get_tag("p") 
       my $storyText = $parser->get_trimmed_text("/FONT");
	$sub1 = substr ($storyText,6,50);
         print "<FONT FACE=arial SIZE=2><p>$sub1</p></FONT>";
      
}

I'm new to perl, so I'm sure that the subroutine wouldn't using the best
method even if it worked!


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

Date: Wed, 18 Aug 1999 09:44:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Problems with acos??
Message-Id: <MPG.122482eafede40de989e6d@nntp.hpl.hp.com>

In article <7pejrt$694$1@lublin.zrz.tu-berlin.de> on 18 Aug 1999 
15:35:25 -0000, Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> says...
 ...
> perldoc -f acos would have told you that Perl doesn't have the
> acos function.  All you get is atan2, which you can look up.
> If you really need acos, you can get it via
> 
>   acos( $x) = atan2( sqrt( 1 - $x*$x),$x);

That approach is presented in `perldoc -f cos`, along with a pointer to 
POSIX::acos().  I would prefer the latter, because the formula seems as 
if it might lose precision severely if the argument is near 1 (i.e., 
acos near 0).

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 18 Aug 1999 09:13:01 -0700
From: moseley@best.com (Bill Moseley)
Subject: pushing an anonymous hash slice
Message-Id: <MPG.12247b6c9ee651b09896c2@nntp1.ba.best.com>


my %h;
@h{ qw/rank file title group/ } = ( split /\t/ )[0,1,2,5];
push @results, \%h;

How do I write without using a temporary hash?




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


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

Date: Wed, 18 Aug 1999 11:39:01 +0000
From: Carlos Cerna <cerna@cig.mot.com>
Subject: someone pleae help
Message-Id: <37BA9B4F.FC0C00D9@cig.mot.com>

This is a multi-part message in MIME format.
--------------0B5A9C6D8A0586F2D9E10490
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Guys I have never wrote a perl script I know a bit about html.My problem
is that I need a script that would read a html page that contains a
table (html generated) and allow me to change 6 text fields and write
the changes back to the file.While on line,of course the script need to
generate a form and ask the user to enter the page to be updated/change
eg:1d.html.Then have 6 text fields to change.

Any help would greatly be appreciated.
--------------0B5A9C6D8A0586F2D9E10490
Content-Type: text/x-vcard; charset=us-ascii;
 name="cerna.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Carlos Cerna
Content-Disposition: attachment;
 filename="cerna.vcf"

begin:vcard 
n:Cerna;Carlos
tel;pager:17232
tel;cell:same
tel;work:847-632-7615
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:cerna@cig.mot.com
note:Legal Notice:Anyone sending unsilicited commercial email to this adress will be charged a $1500 proffreading fee. This is an offical notification. Failure to abide by this will result in legal action as per the following:By US CODE Title 47 ,sec.227(a)(2)
x-mozilla-cpt:;1
fn:Carlos Cerna
end:vcard

--------------0B5A9C6D8A0586F2D9E10490--



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

Date: Wed, 18 Aug 1999 09:30:50 -0700
From: Malcolm Dew-Jones <malcolm.dewjones@moh.hnet.bc.ca>
Subject: Re: statistical sorts
Message-Id: <37BADFBA.1EDD4286@moh.hnet.bc.ca>

> In article <37B9D3CD.DDE13E62@interak.com>,
> Marc Grober  <marc@interak.com> wrote:
 ...
> 
> >if sampling of a,population produces a specific curve showing the
> >incidence of scores on a certain protocol and I want to then produce subsets of
> >that sample with the same distribution I need to distribute members of the
> >original sample such that all the subsets reflect the same statistical curve.
> 
> No, you simply must sample the sample randomly. For example, if your
> sample is 1,2,2,2,3, then a random selection from that sample has a 3/5
> chance of being 2, and 1/5 each of being 1 or 3. That is the same
> distribution you started with, assuming your initial sampling was valid.
> 

A _random_ subset of a sample (such as 1,2,2,2,3) would not
_necessarily_ have 
the same distribution as the sample.  I understand Marc to mean that he
wants 
a subset that is _guaranteed_ to have the same distribution as the
sample.  
(In fact it looks as if he wants to be able to generate numerous such
subsets.)

However, if the sample is so large that one needs to work with a subset 
then wouldn't a random subset would be accurate enough?


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

Date: Wed, 18 Aug 1999 09:28:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Strange Error
Message-Id: <MPG.12247eea85bbe1d0989e6c@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37BACE13.608251DB@blackhole-designs.com> on Wed, 18 Aug 1999 
15:15:51 GMT, Jimmy Humphrey <jimmy@blackhole-designs.com> says...

[using Jeopardy protocol instead of Usent protocol]

> Actually, I'm messing around with part of my script and have found out that
> $date = strftime("%Y-%m-%d",
>         (localtime(time + 60*60*24*180))[0],
>         (localtime(time + 60*60*24*180))[1],
>         (localtime(time + 60*60*24*180))[2],
>         (localtime(time + 60*60*24*180))[3],
>         (localtime(time + 60*60*24*180))[4],
>         (localtime(time + 60*60*24*180))[5],
>         (localtime(time + 60*60*24*180))[6]);
> 
> is the problem.  Also, I can't help what my browser prints off for mail, that's
> just what it does for some mail users, but not others (mainly netscape people)

It is hard to believe that anyone actually wrote that code, let alone 
published it.  Please tell us who the perpretrator is and where it comes 
from.  The CRAP squad will be very interested, I'm sure.

Not only is localtime() called seven (7!) times with the same argument 
(or even conceivably off-by-one) and seven (7!) calls to time(), the 
call to strftime is unnecessary, because sprintf can do it trivially.

  my ($day, $month, $year) = (localtime(time + 60*60*24*180))[3 .. 5];
  $date = sprintf "%d-%.2d-%.2d", 1900 + $year, $month + 1, $day;

And today that says "Happy Valentine's Day, 2000".

As for your mailer problems, your Netscape browser 'X-Mailer: Mozilla 
4.6 [en] (Win98; I)' can control not sending HTML.  
Edit:Preferences:Mail & Groups:Messages and uncheck the box that says 
"By default, send HTML messages."  Why would someone ever want to???

But get a real newsreader, such as Gravity from 
<URL:http://www.microplanet.com>, and you'll never regret it.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 18 Aug 1999 18:50:19 +0200
From: Patrick Bogaart <bogw@geo.vu.nl>
Subject: Re: Wacky Programming Tales
Message-Id: <37BAE44B.E66250BD@geo.vu.nl>

Ben Caradoc-Davies wrote:
> 
> [strange programming]
> The most confidence uninspiring piece of code I ever had the displeasure to
> maintain contained something like this (allegedly C++, but mainly it's
> intersection with C):
> 
>         i = 0;
>         while( i < max_index ) {
>                 /* some copying or update (not modifying i) goes here */
>                 i = i + 1;
>         }
> 
> This was written by a *very* expensive consultant working for a large
> multinational accountancy firm.
> 
> Can anybody suggest an alternative construct which more accurately expresses
> the programmer's intentions? There may be more than one way to do it, but,
> puhleeze!
> 

Yes I can:

	i = 0;
	label_1:;
	/* some use of i */
	i = i + 1;
	if (i==max_index) goto label_2;
	goto label_1;
	label_2:;

<wink>

--
Patrick W. Bogaart
Department of Geomorphology and Quaternary Geology
Faculty  of Earth Sciences,  Vrije Universiteit Amsterdam
bogw@geo.vu.nl            http://www.geo.vu.nl/users/bogw


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

Date: Wed, 18 Aug 1999 13:06:30 -0400
From: roy@popmail.med.nyu.edu (Roy Smith)
Subject: Re: Wacky Programming Tales
Message-Id: <roy-1808991306300001@qwerky.med.nyu.edu>

Patrick Bogaart <bogw@geo.vu.nl> wrote:
> >         i = 0;
> >         while( i < max_index ) {
> >                 /* some copying or update (not modifying i) goes here */
> >                 i = i + 1;
> >         }

> 
>         i = 0;
>         label_1:;
>         /* some use of i */
>         i = i + 1;
>         if (i==max_index) goto label_2;
>         goto label_1;
>         label_2:;
> 
> <wink>

To get the correct behavior for values of max_index less than 0, you need
to change the test from "i == max_index" to "i >= max_index", and you also
need to move the test to directly after label_1.  Other than that, it
looks like perfectly reasonable ratfor-type output (except that the labels
should start at 23001).

-- 
Roy Smith <roy@popmail.med.nyu.edu>
New York University School of Medicine



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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 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.  

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


------------------------------
End of Perl-Users Digest V9 Issue 575
*************************************


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