[12687] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 96 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 9 19:07:16 1999

Date: Fri, 9 Jul 1999 16:05:18 -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           Fri, 9 Jul 1999     Volume: 9 Number: 96

Today's topics:
    Re: array stuff.. <mdz4c@node11.unix.Virginia.EDU>
    Re: array stuff.. <cassell@mail.cor.epa.gov>
    Re: array stuff.. (Larry Rosler)
    Re: Assigning args with regular expressions <jeffp@crusoe.net>
    Re: Assigning args with regular expressions (Larry Rosler)
    Re: Assigning args with regular expressions <anonymous@web.remarq.com>
    Re: Assigning args with regular expressions <anonymous@web.remarq.com>
    Re: Assigning args with regular expressions <cassell@mail.cor.epa.gov>
    Re: Assocative Arrays (Abigail)
    Re: Bath.pm - Bath Perl Mongers (kjc)
    Re: checking Perl offline <garyg@gator.net>
    Re: Deleting everything after a pattern? (Abigail)
    Re: DNS question then sorting by values (Kevin Johnson)
    Re: FAQ 5.7: How can I use a filehandle indirectly? (Jerome O'Neil)
    Re: FAQ 5.7: How can I use a filehandle indirectly? <tchrist@mox.perl.com>
    Re: FAQ 5.7: How can I use a filehandle indirectly? (Jerome O'Neil)
    Re: File Upload that only works if you repost data <cassell@mail.cor.epa.gov>
        Freelance perl/cgi/cookie help wanted. <fetch@fetchound.com>
        hashes and arrays... <jlovette@ic.sunysb.edu>
    Re: Knowing from which script a sub was called. <paul.glidden@unisys.com>
    Re: open+0 <cassell@mail.cor.epa.gov>
    Re: open+0 (Larry Rosler)
    Re: Pattern match counting <dgris@moiraine.dimensional.com>
    Re: Perl & mySQL - Please Help! <paul.glidden@unisys.com>
        Perl & NT: Not Uploading... <anonymous@web.remarq.com>
        Perl and secure shell <jalil@corp.home.net>
        Problem using backticks  <dennis.moreno@pop.safetran.com>
    Re: Problem using backticks <walton@frontiernet.net>
    Re: Problem using backticks <mjcarman@zeus.ia.net>
    Re: Program for Easy Writing of Perl Code <cassell@mail.cor.epa.gov>
    Re: Random Numbers <cassell@mail.cor.epa.gov>
        Regarding Chatpro 2.5 <kuzzero@nconnect.net>
        Speed Differences Perl v. Cold Fusion austintech@my-deja.com
        Speed/Diff - Perl v. Cold Fusion austintech@my-deja.com
        Suggestions: efficient way to compare large text files? mercurius_1@yahoo.com
    Re: totally lost on an error message <gellyfish@gellyfish.com>
    Re: UserAgent (Marcel)
    Re: WEB DEVELOPERS <gellyfish@gellyfish.com>
    Re: WEB DEVELOPERS <cassell@mail.cor.epa.gov>
    Re: Zip codes... <garyg@gator.net>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 9 Jul 1999 17:27:25 -0400
From: Matthew Zimmerman <mdz4c@node11.unix.Virginia.EDU>
Subject: Re: array stuff..
Message-Id: <Pine.A41.4.05.9907091726140.21176-100000@node11.unix.Virginia.EDU>

On Fri, 9 Jul 1999, Larry Rosler wrote about what somebody else wrote:
> > > $str="a";
> > > @test=('0'..'5');
> > > and test would return as ('a0'..'a5')? any help would be greatly
> > > appreciated :)
> > 
> > $_ = "$str$_" for @test;
> 
> I omitted one sentence in my response:
> perlfaq4:  "How do I process/modify each element of an array?"

Actually I can't get 

$_ = "$str$_" for @test;

to work, but

for (@test) {$_ = "$str$_"}

does. Not sure if this is my error or not.

Matt
--
Matthew Zimmerman            http://www.people.virginia.edu/~mdz4c
Interdisciplinary Biophysics Program        University of Virginia
------------------------------------------------------------------
"You got to be very careful if you don't know where you're going,
because you might not get there."                    -- Yogi Berra




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

Date: Fri, 09 Jul 1999 15:16:35 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: array stuff..
Message-Id: <378674C3.5C7AEAE3@mail.cor.epa.gov>

Matthew Zimmerman wrote:
> [SNIP]
> Actually I can't get
> 
> $_ = "$str$_" for @test;
> 
> to work, but
> 
> for (@test) {$_ = "$str$_"}
> 
> does. Not sure if this is my error or not.

No, it just means that you don't have Perl 5.005 .

You might want to type 'perl -v' at a command line and
find out how old your Perl is.  You can always get a more
modern Perl for your own machine, if you find yourself
stuck with an ISP or a network with an old Perl.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 9 Jul 1999 15:12:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: array stuff..
Message-Id: <MPG.11f0139014ba29d1989c8d@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <Pine.A41.4.05.9907091726140.21176-
100000@node11.unix.Virginia.EDU> on Fri, 9 Jul 1999 17:27:25 -0400, 
Matthew Zimmerman <mdz4c@node11.unix.Virginia.EDU> says...
 ...
> Actually I can't get 
> 
> $_ = "$str$_" for @test;
> 
> to work, but
> 
> for (@test) {$_ = "$str$_"}
> 
> does. Not sure if this is my error or not.

perl 5.005

And next time, please don't send 'stealth' e-mail that requires a 
separate response.  See what my newsreader has put in on top.

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


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

Date: Fri, 9 Jul 1999 17:33:33 -0400
From: evil Japh <jeffp@crusoe.net>
Subject: Re: Assigning args with regular expressions
Message-Id: <Pine.GSO.3.96.990709173150.986C-100000@crusoe.crusoe.net>

> if( mainrec($a,$b) = /(.*) yada yada (.*)/) { }

THAT is trying to assign $1 and $2 to the return value(s) of mainrec().
You can fix that in one of the two following ways:
	if (mainrec(/(.*) yada yada (.*)/)){ }
	# this will not set $a and $b, mind you

	if (mainrec(($a,$b) = /(.*) yada yada (.*)/))) { }
	# that sets $a and $b, and then sends them to mainrec()

-- 
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp

Crusoe Communications, Inc.
732-728-9800
www.crusoe.net



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

Date: Fri, 9 Jul 1999 14:28:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Assigning args with regular expressions
Message-Id: <MPG.11f00948692f6bb0989c8b@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7m5n38$td8$1@news.inc.net> on Fri, 9 Jul 1999 15:49:18 -
0500, theoddone33 <eoddonetha@akefilesqua.com> says...
> I know that this code works:
> ----
>  if( ($a,$b) = /(.*) blah blah blah (.*)) { }
> ----
> but this code doesn't
> -----
> sub mainrec {
>   my($arg1,$arg2) = @_;
>   #rest of function
> }
> #more code here
> if( mainrec($a,$b) = /(.*) yada yada (.*)/) { }
> -----
> 
> Am I missing something or is this assignment not possible?  Can I amend
> something to do it this way, or will I be forced to call the function from
> within the if statement?

  if( /(.*) yada yada (.*)/ and mainrec($1, $2)) { }

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


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

Date: Fri, 09 Jul 1999 14:04:27 -0800
From: theoddone33 <anonymous@web.remarq.com>
Subject: Re: Assigning args with regular expressions
Message-Id: <931557869.271@www.remarq.com>

So the $1 $2, etc variables keep their values even outside
the regular expression, eh?  Thanks!

theoddone33



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: Fri, 09 Jul 1999 14:14:25 -0800
From: theoddone33 <anonymous@web.remarq.com>
Subject: Re: Assigning args with regular expressions
Message-Id: <931558466.327@www.remarq.com>

>> if( mainrec($a,$b) = /(.*) yada yada (.*)/) { }
>
>THAT is trying to assign $1 and $2 to the return value(s)
>of mainrec().
Okay, that explains why it doesn't work, which is good to
know.

>You can fix that in one of the two following ways:
>if (mainrec(/(.*) yada yada (.*)/)){ }
># this will not set $a and $b, mind you
This would call the function even if the expression didn't
match, right?  That would result in mainrec incrementing a
hash using an undef key.

>
>if (mainrec(($a,$b) = /(.*) yada yada (.*)/))) { }
># that sets $a and $b, and then sends them to mainrec()
In this case, wouldn't the if only analyze the return of
mainrec, which currently has no return value.
 Under the circumstances, I think Larry Rosler's code would
work better as long as I could still use the $1 and $2
variables later in the if block.

>
>--
>Jeff Pinyan (jeffp@crusoe.net)
>www.crusoe.net/~jeffp
>
>Crusoe Communications, Inc.
>732-728-9800
>www.crusoe.net

theoddone33



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: Fri, 09 Jul 1999 15:27:32 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Assigning args with regular expressions
Message-Id: <37867754.54355E0A@mail.cor.epa.gov>

theoddone33 wrote:
> 
> So the $1 $2, etc variables keep their values even outside
> the regular expression, eh?  Thanks!

Up to a point.  You'll want to read the perlre manpage (which
comes with every proper install of Perl) to get the details.
But the basics are straightforward.  You can use your $1 and $2
variables until the end of the enclosing block or eval string,
or until the next successful pattern match which creates $1 and
$2.  This means you have to be pretty careful where you use 
them, unless you really know what you're doing.  And it means
that you ought to check that you even got a match before using
them, unless you want to deal with the consequences.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 9 Jul 1999 17:53:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Assocative Arrays
Message-Id: <slrn7ocvb0.h7.abigail@alexandra.delanet.com>

Greg Bacon (gbacon@itsc.uah.edu) wrote on MMCXXXVIII September MCMXCIII
in <URL:news:7m5846$ark$2@info2.uah.edu>:
() In article <slrn7oaul1.5k.abigail@alexandra.delanet.com>,
() 	abigail@delanet.com (Abigail) writes:
() : Too bad we can't do (without the use of do{}):
() : 
() : {local $, = "\n";
() :  print for (values %$_) for (values %$_) for (values %$_) for (values %hash);
() : }
() 
() For that to be legal syntax, wouldn't something like
() 
()     print "True!\n" if $foo if $bar if $baz if $quux;
() 
() also have to be legal?


Yes. Wouldn't that be cute?


print "Hello!\n" if $foo unless $bar for $baz while $quux until $hoppa;


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 09 Jul 1999 21:39:34 GMT
From: kjc@nospam.co.uk (kjc)
Subject: Re: Bath.pm - Bath Perl Mongers
Message-Id: <37866b84.44762608@news.freeuk.net>

On Wed, 07 Jul 1999 11:20:50 +0100, Leon Brocard <leon@netcraft.com>
posted:

>Bath.pm is the Perl Monger group for people in the Bath
>(UK) area. 
>
>We meet (very informally) at The Hobgoblin puib in Saint
>James's Parade, Bath, every Wednesday from 6pm.
>
>Come and join us! 
>
OK..... mine's an alf.

I'll be the one wearing a Perldoc.

kjc





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

Date: Fri, 09 Jul 1999 17:58:00 -0400
From: "Gary M. Greenberg" <garyg@gator.net>
Subject: Re: checking Perl offline
Message-Id: <37867068.9D683772@gator.net>

Tom Christiansen wrote:
> Just lately I heard on the radio "Log on to something.com"
> when all the mean is "Connect to http://www.something.com"!  These
> people wouldn't know a login if they saw it.  GRRR!
> 
> --tom

Damn, I tried logging onto that site and all I got was a stinkin
DNS error message ;p

Gary
   -=-  Avenue Programmers' Reference (Create with Perl) -=-
   Class Hierarchy, Requests, and Hyperlinked Sample Scripts:
	     http:/www.gator.net/~garyg/aveclass.htm


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

Date: 9 Jul 1999 17:57:30 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Deleting everything after a pattern?
Message-Id: <slrn7ocvi0.h7.abigail@alexandra.delanet.com>

Bart Lateur (bart.lateur@skynet.be) wrote on MMCXXXVIII September
MCMXCIII in <URL:news:37861ba4.31529806@news.skynet.be>:
$$ Abigail wrote:
$$ 
$$ >Benchmark: timing 100000 iterations of FRUGAL, GREEDY...
$$ >    FRUGAL: 19 secs (17.50 usr  0.00 sys = 17.50 cpu)
$$ >    GREEDY:  1 secs ( 2.33 usr  0.00 sys =  2.33 cpu)
$$ 
$$     FRUGAL:  3 wallclock secs ( 4.34 usr +  0.00 sys =  4.34 CPU)
$$     GREEDY: 14 wallclock secs (13.63 usr +  0.00 sys = 13.63 CPU)
$$ 
$$ Conclusion? Eh...


The conclusion is that you shouldn't draw conclusions from a single
benchmark.



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


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 9 Jul 1999 21:17:16 GMT
From: kevin@prism.ig.utexas.edu (Kevin Johnson)
Subject: Re: DNS question then sorting by values
Message-Id: <7m5oss$2vd$2@geraldo.cc.utexas.edu>

Kevin Johnson (kevin@prism.ig.utexas.edu) wrote:

: foreach $key (sort { $targetSums{$b} <=> $targetSums{$a} } keys(%targetSums))
:         print $targetSums{$key},"\t",$key,"\n";
:         }

: This almost works correctly. It is printing the "\t",$key,"\n" part 
: in correct sorted order. (My earlier code attempt fails in part to
: the fact the values are not unique. duh.) This does not print the
: $targetSums{$key} values though. I don't understand why not. Any
: help would be much appreciated. Thanks again.

Oddly, this would print out values if I printed the values inside
the aforementioned loop that was setting the key/value pairs. I 
noticed a line from "Programming Perl" on page 140 for the each
function:

"The iterator can be reset only by reading all the elements from the
array."

Is this causing my problem? 

Kevin



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

Date: 9 Jul 1999 21:05:41 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <7m5o75$okt$1@brokaw.wa.com>

In article <slrn7ocm0a.b26.siruguri@swing.cs.rice.edu>,
	siruguri@cs.rice.edu (Sameer Siruguri) writes:
> On 9 Jul 1999 04:57:07 -0700, Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
> Why are these illegal? I couldn't find anything in the Perl documentation that
> says so. Why is Perl unable to parse the array variable, $foo[N], and return
> the filehandle stored in it? i.e. why does:
> 
> $a[0]=FileHandle->new();
> open($a[0], "<file");
> $x=<$a[0]>;
> print $x;
> 
> not print the first line in "file"? Note that it compiles though. It doesn't
> print anything however. I use Perl 5.005_01 for sun4-solaris.

Because you havn't payed attention to the documentation.

It speaks thusly:

FileHandle::new creates a FileHandle, which is a reference to a newly 
created symbol (see the Symbol package). If it receives any parameters, 
they are passed to FileHandle::open; if the open fails, the FileHandle
object is destroyed. Otherwise, it is returned to the caller. 

Whatever is in $a[0] isn't a filehandle.  It's an object wrapping to a 
filehandle.

Try using the fh->open() methods described in the pragmata documentation and
see if you have any better luck.

Good Luck!
-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.i-filezone.com


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

Date: 9 Jul 1999 15:55:37 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <37866fd9@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    jeromeo@atrieva.com (Jerome O'Neil) writes:
:Because you havn't payed attention to the documentation.

Actually, I think he paid that part of it enough attention.

:It speaks thusly:

(Was there some reason that you did not find "thus" sufficiently
adverbial for your tastes? :-)

:Whatever is in $a[0] isn't a filehandle.  It's an object wrapping to a 
:filehandle.

No, it is a filehandle.  It's also a reference to a blessed typeglob.
It's also a dessert topping.

  DB<1> use FileHandle
  DB<2> $fh = FileHandle->new(">/dev/tty")
  DB<3> print $fh "stuff!\n"
stuff!
  DB<4> print STDOUT "$fh\n"
FileHandle=GLOB(0x82b8e34)

No, his problem was the indirect object problem with the readline
circumfix operator, which is also a problem with the print function
or anything else that takes an indirect object.  Perhaps it's time to
decline cases in Perl.

    print $fhem $stuffen;

Would be so much clearer, nicht war? :-)

--tom
-- 
"Invincibility depends on one's self; The enemy's vulnerability on him."
				- Sun Tzu 		


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

Date: 9 Jul 1999 22:39:43 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <7m5tnf$trv$1@brokaw.wa.com>

In article <37866fd9@cs.colorado.edu>,
	Tom Christiansen <tchrist@mox.perl.com> writes:
>      [courtesy cc of this posting mailed to cited author]
>:It speaks thusly:
> 
> (Was there some reason that you did not find "thus" sufficiently
> adverbial for your tastes? :-)

Its shorter than "It speaketh thus:"

>     print $fhem $stuffen;
> 
> Would be so much clearer, nicht war? :-)

Yea, verily.


-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.i-filezone.com


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

Date: Fri, 09 Jul 1999 14:34:00 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: File Upload that only works if you repost data
Message-Id: <37866AC8.D02A1EBD@mail.cor.epa.gov>

Nick Sanders wrote:
> 
> I'm running Apache locally on windows and am trying to upload a file
> using CGI.pm when I submit the form I get a internal server error and
> the error log says -
> 'Premature end of script headers: d:/msd/cgi-bin/newsletter.pl'
> When I refresh the page and repost the data, the file is uploaded and
> everything works fine.
> 
> Here is the file upload code
> 
>   open (FILE,">".$full_filename);
>   binmode (FILE);
> 
>   while ($bytes_read = read($upload_file, $buffer, 65536)){
>   print FILE $buffer;
>   $total += $bytes_read;
>   }
> 
>  close FILE;
> 
> Has any one any ideas ?

A few.  Here's one that's probably not germane to your current
problem.  ALWAYS check the return on your open(), especially
in something like a CGI script where you need to put in a
graceful way of dealing with a failure.

Now then. An error message like:
    'Premature end of script headers: ...
often means that you didn't get HTLM headers out before you
sent the output.  Since this works the second time, one
might hazard a wild guess that your headers are showing up
*after* your text, hence are providing a valid header for
the second copy of the text.  But that's just a wild guess.
The relevant portions of your code aren't here, and my
PSI::ESP module is acting up today.

But you could check this.  First, you may need to set
$|++;
if you have two different sources being thrown at STDOUT,
as you appear to (based on what the PSI::ESP module tells 
me).  Second, you may need to repair or move your HTML
header line.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 09 Jul 1999 15:01:17 -0800
From: Tomh <fetch@fetchound.com>
Subject: Freelance perl/cgi/cookie help wanted.
Message-Id: <931561279.827@www.remarq.com>


Hi,

Have a create/set/get/use cookie project.

Further details provided via Email and WWW upon request.

Thanks for your time.

Tom Hicks
tomh@idowebs.com



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: Fri, 09 Jul 1999 18:35:56 -0400
From: James Lovette <jlovette@ic.sunysb.edu>
Subject: hashes and arrays...
Message-Id: <3786794C.1376@ic.sunysb.edu>

how would I compare each element in an array to see if it matched any
hash key?

%dates = ("time1", "June 3 - June 10",
          "time2", "June 10 - June 17",
          "time3", "June 17 - June 24",
          "time4", "June 24 - July 1",	
          "time5", "June 1 - July 8",
          "time6", "July 8 - July 15",
          "time7", "July 18 - July 22",
          "time8", "July 22 - July 29",
          "time9", "July 29 - August 5",
          "time10", "August 5 - August 12",
          "time11", "August 12 - August 19",
          "time12", "August 19 - August 26",
          "time13", "August 26 - September 2");

is my hash, and the keys are possible values in an array (depending on
what the user choses). how can I compare the two, so that i can
tell if $value[5] = "time11" that $value[5] is also equal to "August 12
- August 19"? thanks for the help.


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

Date: Fri, 9 Jul 1999 16:15:03 -0500
From: "Paul Glidden" <paul.glidden@unisys.com>
Subject: Re: Knowing from which script a sub was called.
Message-Id: <7m5oou$cdb$1@bbnews1.unisys.com>

If you have your class set up correctly, the first argument ($0) passed to
it will be the name of the object that called it.  If the class is set up
correctly, it will necessitate that the object be declared correctly using
$obj_name->new().

Once the object has been declared it can easily be kept track of using $0 as
was previously stated.

christian.sylvestre@cetelem.fr wrote in message
<7m556t$d64$1@nnrp1.deja.com>...
>I have a problem with a subroutine in one of my script. THis subroutine
>is called very often from other module (scripts) and I was wondering if
>there is a simple way to know in which script called a subroutine (from
>inside the subroutine).
>
>Thanx
>
>Christian Sylvestre
>-------------------
>R & D, UNIX
>Cetelem, Paris, France
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.




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

Date: Fri, 09 Jul 1999 14:20:09 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: open+0
Message-Id: <37866789.C2C0E851@mail.cor.epa.gov>

Eric The Read wrote:
> 
> abigail@delanet.com (Abigail) writes:
> > Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCXXXVIII
> > September MCMXCIII in <URL:news:7m3mdh$6vl$1@lublin.zrz.tu-berlin.de>:
> > {}
> > {} He forgot to mention we all start counting at zero.
> >
> > Hah! Except me. I always start my programs with $[ = 7.
> 
> Yes, but shouldn't we leave Advanced Evil as an excercise for the
> student, instead of providing ready-made answers like that?  You have to
> let them learn *something* for themselves, after all.

Hmmm.  I thought Advanced Evil was taught in Redmond.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 9 Jul 1999 14:35:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: open+0
Message-Id: <MPG.11f00adbcb6a4b7e989c8c@nntp.hpl.hp.com>

In article <37866789.C2C0E851@mail.cor.epa.gov> on Fri, 09 Jul 1999 
14:20:09 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> Eric The Read wrote:
> > abigail@delanet.com (Abigail) writes:
> > > Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCXXXVIII
> > > September MCMXCIII in <URL:news:7m3mdh$6vl$1@lublin.zrz.tu-berlin.de>:
> > > {}
> > > {} He forgot to mention we all start counting at zero.
> > >
> > > Hah! Except me. I always start my programs with $[ = 7.
> > 
> > Yes, but shouldn't we leave Advanced Evil as an excercise for the
> > student, instead of providing ready-made answers like that?  You have to
> > let them learn *something* for themselves, after all.
> 
> Hmmm.  I thought Advanced Evil was taught in Redmond.

'Practiced', not 'taught'.  Nothing is taught in Redmond.  Just look at 
the evidence demonstrated in this newsgroup.

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


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

Date: 09 Jul 1999 16:25:31 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Pattern match counting
Message-Id: <m3673t31gk.fsf@moiraine.dimensional.com>

gbacon@itsc.uah.edu (Greg Bacon) writes:

<snip lots>

>  Justify || retract;

I think that you probably wanted list context there.  :-)

dgris
- not to mention the horrible stylistic issues of some
ucfirst() subs and some lc() subs.  :-)
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Fri, 9 Jul 1999 16:32:11 -0500
From: "Paul Glidden" <paul.glidden@unisys.com>
Subject: Re: Perl & mySQL - Please Help!
Message-Id: <7m5pop$d6k$1@bbnews1.unisys.com>


nick wrote in message <378658E2.527096BC@auger.net>...
>Can anyone give me some examples on adding a value to a mySQL database,
>then getting that value?  Please help!  Any examples would be great!


Have you looked at the DBI man pages, or the DBD::mysql manpages.  Within
these manpages are excellent examples of how to connect to the database, do
updates using sql commands etc.




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

Date: Fri, 09 Jul 1999 14:37:23 -0800
From: Cedric Nagy <anonymous@web.remarq.com>
Subject: Perl & NT: Not Uploading...
Message-Id: <931559845.545@www.remarq.com>

Hi everyone

I am trying to install a perl script that allows managment
and uploading of files with only one FTP account (interface
similar to Geocities, etc.). Although I have look at the
list of available scripts at CGI Resources (few free ones
are available for NT), the server that our school uses seems
to be not quite standard. I finally got ahold of an older
(free) version of a script that has evolved into a
commercial product- therefore I cannot recieve support from
the company.
In principal everything works fine, after a few tweaks were
made (ie. having to refer to other files by the full path
and not just the filename... the server thinks somehow that
it is running in C:\Perl\mod or something). The only thing
that doesn't work is the uploading of files. I either
recieve a blank page or the browser locks on "Waiting for
reply...". I would think that this might have something to
do with the directory that the server thinks the script is
running in; but I have scanned the code and cannot see
anywhere that an external file is called in the upload
section. Creating new files and editing existing files seems
to work fine.
What might be going wrong?

I am aware that other products exist, but they do not
provide the features that I need (encrypted password
storage, easy account creation which must be verified by me,
etc.) for the price that my highschool can afford to pay:
free.

Any help or suggestions are appreciated.

Thanks a bunch.

cedric

replies to cedric AT cableworks DOT org



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: Fri, 09 Jul 1999 22:02:35 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: Perl and secure shell
Message-Id: <931557755.357795@zeppelin.svr.home.net>

Is there any support for secure shell in Perl, especially for Windows?

Thanks,

-Jalil





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

Date: Fri, 09 Jul 1999 22:22:53 GMT
From: dennis <dennis.moreno@pop.safetran.com>
Subject: Problem using backticks 
Message-Id: <37867647.C949CD66@pop.safetran.com>

Can anyone tell me what wrong with this code?
I want it print a single line for each user showing the Full Name, login
name and groups.
It prints the values of $comment and $name but not $groups.

#!/usr/local/bin/perl
getpwent();
while (@list = getpwent()) {
    ($name,$comment) = @list[0,5];
    $goups = `/usr/bin/groups $name`;
    print "$comment $name $groups\n";
}
endpwent();

Thanks


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

Date: Fri, 09 Jul 1999 18:31:37 -0400
From: Bob Walton <walton@frontiernet.net>
To: dennis <dennis.moreno@pop.safetran.com>
Subject: Re: Problem using backticks
Message-Id: <37867848.1672C78D@frontiernet.net>

dennis wrote:

> Can anyone tell me what wrong with this code?
> I want it print a single line for each user showing the Full Name, login
> name and groups.
> It prints the values of $comment and $name but not $groups.
>
> #!/usr/local/bin/perl
> getpwent();
> while (@list = getpwent()) {
>     ($name,$comment) = @list[0,5];
>     $goups = `/usr/bin/groups $name`;

     ^^^^^^^^^^^goups

>
>     print "$comment $name $groups\n";

                                    ^^^^^^^^^^^^^^^^^^^groups

>
> }
> endpwent();
>
> Thanks



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

Date: Fri, 09 Jul 1999 17:39:59 -0500
From: Michael Carman <mjcarman@zeus.ia.net>
Subject: Re: Problem using backticks
Message-Id: <37867A3F.922FCD9B@zeus.ia.net>

dennis wrote:

> Can anyone tell me what wrong with this code?
> I want it print a single line for each user showing the Full Name, login
> name and groups.
> It prints the values of $comment and $name but not $groups.
>
> #!/usr/local/bin/perl
> getpwent();
> while (@list = getpwent()) {
>     ($name,$comment) = @list[0,5];
>     $goups = `/usr/bin/groups $name`;
>     print "$comment $name $groups\n";
> }
> endpwent();

Hey, this one is easy! You never set $groups, you set $goups. Just a typo.
But, to protect against such things, you should (say it with me, everyone):
Always use -w and 'use strict'.



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

Date: Fri, 09 Jul 1999 14:09:48 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Program for Easy Writing of Perl Code
Message-Id: <3786651C.21CB3731@mail.cor.epa.gov>

Jeff Stampes wrote:
> 
> Abigail <abigail@delanet.com> took the easy shot and sniped:
> : Francisco Romero (fromero@csudh.edu) wrote on MMCXXXVIII September
> : MCMXCIII in <URL:news:37859486.8CA70542@csudh.edu>:
> [snip]
> : -- I use inux.
> 
> : I've never heard of that.
> 
> http://www-masuda.is.s.u-tokyo.ac.jp/~kourai/inux/inux-en.html

Yes, but...  has anyone ported Perl to a dog?  And if so, do
I even want to know about it?  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 09 Jul 1999 14:17:54 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Random Numbers
Message-Id: <37866702.E81E7EBE@mail.cor.epa.gov>

Larry Rosler wrote:
> 
> In article <378638DB.1C12D9C2@mail.cor.epa.gov> on Fri, 09 Jul 1999
> 11:00:59 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> ...
> > Math::TrulyRandom may not be random anyway, merely chaotic.
> > I haven't seen an adequate analysis of it.
> 
> Hello!  There are no random-number algorithms, by definition.

That *was* my point.  The claim made for the technique underlying
Math::TrulyRandom is that is *does* produce random numbers.
However, the process used may actually produce a predictable 
sequence of numbers within a smaller space than rand() 
generates.  I haven't evaluated it.  I've only read the docs
and become suspicious.

>                                                               Special
> hardware (such as a radioactive-decay detector) is required.  See Knuth,
> Vol. 2, Ch. 3, 'Random Numbers' and especially the rubric:
> 
> "Anyone who considers arithmetical methods of producing random digits
> is, of course, in a state of sin.  John von Neumann (1951)"

One of my favorite quotes.

But on a related topic, why doesn't Perl use a better rand()
algorithm than the OS provides, given how lousy some of these
are?  You read Jon Orwant's article in The Perl Journal too,
right?

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 9 Jul 1999 17:11:08 -0500
From: "John Curry" <kuzzero@nconnect.net>
Subject: Regarding Chatpro 2.5
Message-Id: <7m5rru$rue@enews2.newsguy.com>

Thanks anyway, but the author of the script got back to me, it is a genuine
bug in the script, he is currently re-writing the script to repair the bug,
but thanks for the various suggestions, the help was appreciated.




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

Date: Fri, 09 Jul 1999 21:50:31 GMT
From: austintech@my-deja.com
Subject: Speed Differences Perl v. Cold Fusion
Message-Id: <7m5qr3$m3l$1@nnrp1.deja.com>

I am currently evaluating the use of PERL v. Cold Fusion for a
high-end data services site. The SQL queries will be made against
millions of records at a time. Our server platform will be Sun Solaris
with
Apache.

I've used both but tend to like PERL more.  The mixed programming logic
and HTML snippet nature of Cold Fusion seems to bother me a little.
However,if there are considerable advantages in speed or processing
power through the cold fusion server I might tend towards that
environment to develop our application in.

If PERL is our choice I will run everything through mod_perl in order to
speed up any CGI requests.

I'm having difficulty retrieving any information on comparisons between
the two development environments. Any time Cold Fusion has been
compared, it has been against other commercial products.

Has anyone had any experience in comparing CF v. PERL for speed in
processing CGI type scripts?

Thanks



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


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

Date: Fri, 09 Jul 1999 21:47:20 GMT
From: austintech@my-deja.com
Subject: Speed/Diff - Perl v. Cold Fusion
Message-Id: <7m5ql4$m14$1@nnrp1.deja.com>

I am currently evaluating the use of PERL v. Cold
Fusion for a
high-end data services site. The SQL queries will
be made against
millions of records at a time. Our server
platform will be Sun Solaris with
Apache.

I've used both but tend to like PERL more.  The
mixed programming logic
and HTML snippet nature of Cold Fusion seems to
bother me a little. However,
if there are considerable advantages in speed or
processing power through
the cold fusion server I might tend towards that
environment to develop our
application in.

If PERL is our choice I will run everything
through mod_perl in order to
speed up
any CGI requests.

I'm having difficulty retrieving any information
on comparisons between the
two
development environments. Any time Cold Fusion
has been compared, it has
been against other commercial products.

Has anyone had any experience in comparing CF v.
PERL for speed in
processing
CGI type scripts?

Thanks


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


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

Date: Fri, 09 Jul 1999 22:31:25 GMT
From: mercurius_1@yahoo.com
Subject: Suggestions: efficient way to compare large text files?
Message-Id: <7m5t7t$n09$1@nnrp1.deja.com>

Using active server pages written in either Javascript or Perl, I would
like to be able to compare two plain text files of 5-15 pages in length
-- an original and a revised file. When additions are made to the
revised file, I want to be able to distinguish this new text from the
original (so it can be colored differently).

Does anyone have any suggestions on how best to do this in an efficient
way? I've used strcmp in the past for smaller tasks, but I wonder how
well that will work in a long document that may be up to 15 pages in
length. Suggestions on how best to compare the old/new versions of the
document would be very much appreciated.

Thank you.
Mercury


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


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

Date: 8 Jul 1999 20:58:57 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: totally lost on an error message
Message-Id: <7m33eh$142$1@gellyfish.btinternet.com>

On Thu, 8 Jul 1999 09:59:03 -0700 Dodger wrote:
> Okay, this is a rarity... I don't usually post 'totally lost' type stuff,
> but I'm totally lost.
> 
> I went and installed Image::Magick because I thought it would be pretty cool
> to have a banner that showed who was in my chatroom. Not a bad idea, is it?
> 

Sounds totally cheeezy to me - but thats me ...

> perl: can't resolve symbol 'FormatString'

It is a message from the dynamic linker if I dont miss my guess - you
done gone installed something wrong.  It sure aint a perl error thats
for sure ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 09 Jul 1999 20:16:42 GMT
From: marcel.grunauer@lovely.net (Marcel)
Subject: Re: UserAgent
Message-Id: <378657a7.33058705@enews.newsguy.com>

On Fri, 09 Jul 1999 18:54:41 GMT, chenlg@my-deja.com wrote:

>In  what format should I use to provide a username
>and password pair to query a password protected
>web page, I try this:
>
>	my $ua = new LWP::UserAgent;
>$ua->agent ("Mozilla/4.02 [en] (Win95;I)");
>$self->{ua} = $ua;
>$self->{jsWritten} = 0;
>$self->{modified} = 0;
>$self->{userName} = 'myname';
>$self->{password} = 'mypassword';
>return $self;
>
>it does not work, any idea??

what is $self referring to?


If you are talking about basic authorization, try this to get the
contents of a page at a certain URL:

#!/usr/bin/perl -w

use strict;

my $ua = new LWP::UserAgent;
my $path = "http://www.whatever.com/xxx.html";
my $uname = 'myname';
my $password = 'mypassword';

# create a GET request that includes the basic auth header
my $headers = new HTTP::Headers;
$headers->authorization_basic($uname, $password);
my $request = new HTTP::Request("GET", $path, $headers);
my $response = $ua->request($request);


There are further examples in lwpcook and other LWP modules'
documentation.


Marcel
-- 
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'


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

Date: 8 Jul 1999 20:53:54 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: WEB DEVELOPERS
Message-Id: <7m3352$13v$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> <posted and CC sent>
> 
> In comp.lang.perl.misc Element Limited <resume-cv@element-limited.com> wrote:
>> 
>> 
>> WEB DEVELOPERS
>> LONDON TO £30,000
>> 
> 
> Why did you post this into three italian newsgroups if the Job is in London ?
> Saying that why did you post to any group that didnt have 'jobs' in the
> name ?
> 

The funny thing about this is that I got a nice message from a cancelbot
operating in the it.* hierarchy - so presumably the original post was
likewise cancelled.  I wonder if we could get such a 'bot together here ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 09 Jul 1999 15:21:13 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: WEB DEVELOPERS
Message-Id: <378675D9.6476C66E@mail.cor.epa.gov>

Jonathan Stowe wrote:
> [snip]
> The funny thing about this is that I got a nice message from a cancelbot
> operating in the it.* hierarchy - so presumably the original post was
> likewise cancelled.  I wonder if we could get such a 'bot together here ...

Sure we could...  But once TomC 'improved' it, it would cancel
every post that included any of the following phrases:
'probably a FAQ'
'didn\'t read the FAQ'
'newbie'
'write me a script'
   .
   .
   .

Wait, on second thought I'm liking this bot idea more and more...

[Now John Stanley will walk over here and smack me one.  :-]

David, ducking in advance :-)
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Fri, 09 Jul 1999 18:41:47 -0400
From: "Gary M. Greenberg" <garyg@gator.net>
Subject: Re: Zip codes...
Message-Id: <37867AAB.6C38CE7F@gator.net>

Use Perl for perlish problems; imo this is a GIS problem;

Doug Crabtree wrote:
> 
> I once saw a post here about zip codes.  Is there any information out > there about perl modules that have functions dealing with zip codes.
> i.e. returning a list of zip codes in a x mile radius of single zip > code?
> 
Gary
   -=-  Avenue Programmers' Reference (Created with Perl) -=-
   Class Hierarchy, Requests, and Hyperlinked Sample Scripts:
	     http:/www.gator.net/~garyg/aveclass.htm


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

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". 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 V9 Issue 96
************************************


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