[12673] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 82 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 8 18:07:11 1999

Date: Thu, 8 Jul 1999 15:05:11 -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           Thu, 8 Jul 1999     Volume: 9 Number: 82

Today's topics:
        \d \s ?? <cayce@thurston.com>
    Re: \d \s ?? <rick.delaney@home.com>
        Assocative Arrays <hannak@kodak.com>
    Re: Assocative Arrays (Andrew Johnson)
    Re: Assocative Arrays <tchrist@mox.perl.com>
    Re: Autodecrementing strings. (Abigail)
    Re: cgi timeout (Abigail)
    Re: Computing log base 10 in perl <cassell@mail.cor.epa.gov>
    Re: Connection problem using Perl DBI and IIS4 pessiembre@netscape.net
        Correct syntax for NT drives <jim.ray@west.boeing.com>
    Re: Correct syntax for NT drives (Greg Bacon)
        Emulating C++ Class Templates williajp@my-deja.com
    Re: Emulating C++ Class Templates <tchrist@mox.perl.com>
    Re: Exclusive file IO (Abigail)
    Re: Floating Point Number With Time Function (Bart Lateur)
    Re: How to force the CGI to end when the browser stop l (Abigail)
    Re: How to run a Perl script as an NT Service? (Michael Rubenstein)
    Re: I need to hide the source (Abigail)
    Re: I need to hide the source (Bart Lateur)
    Re: I need to hide the source (Greg Bacon)
    Re: Language-Suck-O-Meter ? (Charles Dexter Ward)
        Microsoft Word -> TXT? <gj_at_work@my-deja.com>
        Newbie assoc array question <heather.wiley@bentley.com>
        output from cgi to webpage qingshan@my-deja.com
    Re: Pattern match counting (Bart Lateur)
    Re: Pattern match counting (Greg Bacon)
    Re: Perl - problem with 'open' <jcreed@cyclone.jprc.com>
    Re: Perl - problem with 'open' (John Borwick)
    Re: Perl - problem with 'open' <paul.glidden@unisys.com>
    Re: Perl Installation errors on Solaris 2.5 system <elaine@chaos.wustl.edu>
        Pipe mail into flat database file <kjcox@vii.com>
    Re: Pipe mail into flat database file <jonesy@rmi.nospam.net>
        Self-referencing hash? Ick? <larry@ldis.com>
    Re: Self-referencing hash? Ick? <tchrist@mox.perl.com>
    Re: Time calculations in Perl for Win32 <cassell@mail.cor.epa.gov>
        toturial <djestes@bellsouth.net>
        using MIME::* to analyze email (John Klassa)
        Which is better, Oracle or Sybase? <als48@pantheon.yale.edu>
    Re: Which is better, Oracle or Sybase? (Greg Bacon)
    Re: Which is better, Oracle or Sybase? <rick.delaney@home.com>
    Re: Which is better, Oracle or Sybase? (Abigail)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 8 Jul 1999 14:16:17 -0700
From: "Cayce Collins" <cayce@thurston.com>
Subject: \d \s ??
Message-Id: <7m34gr$6an$1@quark.scn.rain.com>

I am begining my perl walk into the clouds, and need help with this
following line:

if(/^($input_for{'username'})(\s*)Hours:(\d*)(\s*)Minutes:(\d*)(\s*)/){

what does the \s* and \d* mean ?




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

Date: Thu, 08 Jul 1999 21:24:07 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: \d \s ??
Message-Id: <378516C2.4595A9DD@home.com>

[posted & mailed]

Cayce Collins wrote:
> 
> if(/^($input_for{'username'})(\s*)Hours:(\d*)(\s*)Minutes:(\d*)(\s*)/){
> 
> what does the \s* and \d* mean ?

All of Perl's regular expression metacharacters are explained in the
manual, specifically in the section, perlre.  Here is an excerpt:

    \w  Match a "word" character (alphanumeric plus "_")
    \W  Match a non-word character
    \s  Match a whitespace character
    \S  Match a non-whitespace character
    \d  Match a digit character
    \D  Match a non-digit character

I leave research for the meaning of '*' to you.

perldoc perlre

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Thu, 08 Jul 1999 17:25:43 -0400
From: Victor Hannak <hannak@kodak.com>
Subject: Assocative Arrays
Message-Id: <37851757.A2CD15E9@kodak.com>

Does Perl support triply or quadruply nested associative arrays?

How would you dereference something like this.

Eg.

$Level1_key{$level2_key{$level3_key{$level4_key}}}= value

What would my print statement look like?

Also, when creating a hash, can the value portion be an array of hashes?

Thanks.



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

Date: Thu, 08 Jul 1999 21:39:29 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Assocative Arrays
Message-Id: <lU8h3.5007$SH6.132353@news1.rdc2.on.home.com>

In article <37851757.A2CD15E9@kodak.com>,
 Victor Hannak <hannak@kodak.com> wrote:
! Does Perl support triply or quadruply nested associative arrays?
! 
! How would you dereference something like this.
! 
! Eg.
! 
! $Level1_key{$level2_key{$level3_key{$level4_key}}}= value

that isn't likely to do what you want...you should check the
following documentation pages:

perlreftut  (with recent perl distributions)
perlref
perllol
perldsc 

access them with 'man perlref' or 'perldoc perlref' or visit
www.perl.com for a link to online versions.

! Also, when creating a hash, can the value portion be an array of hashes?

yes, if you mean, can the value portion be a reference to an array
of hash references ... see the above documentation.

regards
andrew


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

Date: 8 Jul 1999 15:51:53 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Assocative Arrays
Message-Id: <37851d79@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Victor Hannak <hannak@kodak.com> writes:
:Does Perl support triply or quadruply nested associative arrays?
 ...
:Also, when creating a hash, can the value portion be an array of hashes?

Which part of the standard Perl documentation that's sitting there on
your very own system and that also happens to answer these questions in
laborious detail did you find particularly opaque?  Please tell me
so I can fix it.  

--tom
-- 
"A young man who is not a radical about something is a pretty poor risk
 for education."
				- Jacques Barzun


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

Date: 8 Jul 1999 15:10:52 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Autodecrementing strings.
Message-Id: <slrn7oa1dm.vka.abigail@alexandra.delanet.com>

Lee Benfield (lbenfie1@avwb001.aveley.ford.com) wrote on MMCXXXVII
September MCMXCIII in <URL:news:3784BC89.852F9684@avwb001.aveley.ford.com>:
\\ 
\\ Anyone know why the behaviour for autoincrement and autodecrement
\\ don't tie up when used on strings?


Because you can't always decrement. What is the following supposed
to print:  $a = 'a0'; $a--; print $a;?



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


  -----------== 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: 8 Jul 1999 15:12:44 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: cgi timeout
Message-Id: <slrn7oa1h3.vka.abigail@alexandra.delanet.com>

Nicola (nicolabo@prof.it) wrote on MMCXXXVII September MCMXCIII in
<URL:news:7m2f5j$o51$1@serv1.iunet.it>:
\\ I'd want to run a perl script that need 30 minutes to execute,
\\ but this is killed by the cgi-timeout limit of the server.
\\ Is there a method to avoid the timeout limit?


Reconfigure your server.

Followups set.


Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


  -----------== 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: Thu, 08 Jul 1999 14:05:00 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Computing log base 10 in perl
Message-Id: <3785127C.24EEA198@mail.cor.epa.gov>

Craig Berry wrote:
> 
> Abigail (abigail@delanet.com) wrote:
> : Greg Miller (gmiller@iglou.com) wrote on MMCXXX September MCMXCIII in
> : <URL:news:377ff726.650266004@news.alt.net>:
> : @@    The log function in perl is base e.  I know there's a way to
> : @@ use the base e log to compute the log base 10.  Does anyone know how
> : @@ it's done?
> :
> : That's both a FAQ and a second grade math rule.
> 
> I'd love to know where you went to second grade!

Everyone knows that Abigail is a graduate of Star Fleet Academy,
and took differential geometry honors in fourth grade.  Her
sixth-grade paper on the topological connectedness of convex 
polytopes embedded in infinitely differentiable Riemannian
manifolds is on her website.  Didn't you look before asking?

Boy, the public schools these days...

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


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

Date: Thu, 08 Jul 1999 20:27:09 GMT
From: pessiembre@netscape.net
Subject: Re: Connection problem using Perl DBI and IIS4
Message-Id: <7m31id$mb7$1@nnrp1.deja.com>

I finally got an answer back from our client, and the Sybase error log
contains nothing of value except a whole bunch of "user has been
disconnected" (or something similar).

In article <slrn7o7qlb.ued.abigail@alexandra.delanet.com>,
  abigail@delanet.com wrote:
> Pascal Essiembre (pessiembre@netscape.net) wrote on MMCXXXVI September
> MCMXCIII in
<URL:news:n2Pg3.23579$Xr4.199771@c01read02-admin.service.talkway.com>:
> %% Hi,
> %%
> %% I have connection problems when multiple users try to connect at
the
> %% same time to a Sybase database using Perl DBI through IIS4.
>
> Did you check the Sybase errorlog? Did you check your servers
errorlog?
> Do you have something more substantial than "my query just stops"?
>
> Abigail
> --
> package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
>                                       print } sub __PACKAGE__ { &
>                                       print (     __PACKAGE__)} &
>                                                   __PACKAGE__
>                                             (                )
>
>   -----------== 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 ==-----
>


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


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

Date: Thu, 8 Jul 1999 20:19:40 GMT
From: "Jim Ray" <jim.ray@west.boeing.com>
Subject: Correct syntax for NT drives
Message-Id: <FEKJ4G.77J@news.boeing.com>

I have 2 servers, 1 has the Perl and IIS and the other is the data.  I am
trying to grab a directory of the files on the data server, but am having
problems with the syntax.

 $filepath = "\\nt-delta-02\epmr\PMR-B\Program_Quality;

Is what I am using with no luck.  I have also used "//" and still no luck.
Can someone please direct me to the proper syntax for address NT server
mapping?

Thank you.

Jim




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

Date: 8 Jul 1999 21:26:15 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Correct syntax for NT drives
Message-Id: <7m351n$qna$3@info2.uah.edu>

In article <FEKJ4G.77J@news.boeing.com>,
	"Jim Ray" <jim.ray@west.boeing.com> writes:
:  $filepath = "\\nt-delta-02\epmr\PMR-B\Program_Quality;

Go back and read the perlop manpage, taking careful note when you start
reading the "Quote and Quote-like Operators" section.

Greg
-- 
Nothing inspires forgiveness quite like revenge. 
    -- Dogbert


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

Date: Thu, 08 Jul 1999 20:02:12 GMT
From: williajp@my-deja.com
Subject: Emulating C++ Class Templates
Message-Id: <7m303r$llq$1@nnrp1.deja.com>

I want to derive classes A2 and B2 from, respectively, A1 and B1, where
A1 and B1 share a common parent class.  The new code is identical in
both derivations.  That is, A2 and B2 override and add the same
methods.  I cannot modify any code in the A1 and B1 class hierarchies
and do not want to write a bunch of forwarding functions since A1 and
B1 are so large.

So, I'd like to write a class C that would be equivalent to A2 when its
parent is A1, but would be equivalent to B2 if its parent is B1.  In
C++, I'd make C a class template whose template parameter is its parent
class.  How can I get the same effect in Perl?

Thanks,

Jim Williams


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


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

Date: 8 Jul 1999 15:44:28 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Emulating C++ Class Templates
Message-Id: <37851bbc@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    williajp@my-deja.com writes:
:I want to derive classes A2 and B2 from, respectively, A1 and B1, where
:A1 and B1 share a common parent class.  The new code is identical in
:both derivations.  That is, A2 and B2 override and add the same
:methods.  I cannot modify any code in the A1 and B1 class hierarchies
:and do not want to write a bunch of forwarding functions since A1 and
:B1 are so large.
:
:So, I'd like to write a class C that would be equivalent to A2 when its
:parent is A1, but would be equivalent to B2 if its parent is B1.  In
:C++, I'd make C a class template whose template parameter is its parent
:class.  How can I get the same effect in Perl?

I think you need to step outside your little C++ box.  It's constricting
your brain.  The first part of what you said this:

    @A2::ISA = ('A1');
    @B2::ISA = ('B1');

The next part, however, doesn't make sense.  It went something
like this:

    @C::ISA = ('A2') if C->isa('A1');
    @C::ISA = ('B2') if C->isa('B1');

That's nutty.  If you want C to be an A2, then say so.  If you rather
C were be a B2, then just say that.  And if you start doing this:

    for (@C::ISA) { s/^([AB])1$/${1}2/ } 

You're definitely looking to be excoriated.

Perl doesn't need templates.  We're already remarkably polymorphic,
thank you very much.

--tom
-- 
"Inventions have long since reached their limit, and I see no hope for further 
 development." 
  - Julius Sextus Frontinus, Highly regarded engineer in Rome 1st century A.D. 


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

Date: 8 Jul 1999 15:15:11 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Exclusive file IO
Message-Id: <slrn7oa1lm.vka.abigail@alexandra.delanet.com>

Joe Wong (joewong@ima.com) wrote on MMCXXXVII September MCMXCIII in
<URL:news:7m1btv$13g$1@m5.att.net.hk>:
\\ Hi, in Perl, how can do excuslive file I/O? That is only one can read and
\\ write to a file in the same time?


You can't do that. Of course, the manual claim you can, but why should
you believe the manual? You didn't skip reading it for no reason!



Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


  -----------== 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: Thu, 08 Jul 1999 20:48:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Floating Point Number With Time Function
Message-Id: <37880e40.1411572@news.skynet.be>

Troy Knight wrote:

>Is there a way to return the time to a certain amount of decimal places.

No. Time is an integer number of seconds. No decimal places.

You may peek into the Benchmark module, and see how they get a finer
resolution (for your platform, whatever that may be).

	Bart.


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

Date: 8 Jul 1999 15:23:19 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to force the CGI to end when the browser stop loading data ?
Message-Id: <slrn7oa250.vka.abigail@alexandra.delanet.com>

Alain BORGO (alain.borgo@ratp.fr) wrote on MMCXXXVII September MCMXCIII
in <URL:news:3784CA86.1C719C20@ratp.fr>:
%% 
%% Can I trap something within the CGI to end the script if the browser
%% stop loading the data ?

Read the manual of your server. If the server has a way to tell your
program, implement that method. If the server hasn't, you're out of
luck.

This is not a Perl question.

Goodbye.


Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
                       -> define ("foldoc", "perl")) [0] -> print'


  -----------== 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: Thu, 08 Jul 1999 21:41:57 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: How to run a Perl script as an NT Service?
Message-Id: <378e1aaf.124663376@nntp.ix.netcom.com>

On Thu, 08 Jul 1999 18:31:19 GMT, tbittner@my-deja.com wrote:

>I'd really like to know how you can run a perl script as an NT
>service.  Anyone know how?  We're already using Activestate Perl for
>login scripting.  The program I need to run watches for requests to
>change account information that are sent at all times of day, so it
>needs to be run as a system-level service.  Any help is *greatly*
>appreciated.  Thanks!

The NT Resource Kit contains a program srvany that allows one to
run any program as a service.  It works quite well with perl.
-- 
Michael M Rubenstein


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

Date: 8 Jul 1999 15:27:38 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: I need to hide the source
Message-Id: <slrn7oa2d3.vka.abigail@alexandra.delanet.com>

rdosser@my-deja.com (rdosser@my-deja.com) wrote on MMCXXXVII September
MCMXCIII in <URL:news:7m2g34$eas$1@nnrp1.deja.com>:
~~ 
~~ There *is* a very poor design involved, for business reasons that are
~~ beyond my control. The people who own/administer the host are the ones
~~ we want to protect the data from, if you can believe that, so my private
~~ key would not be very private.


That's very stupid. Wouldn't it be much simpler to find someone you
trust who can administer the box? 


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


  -----------== 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: Thu, 08 Jul 1999 20:49:53 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: I need to hide the source
Message-Id: <37890eb6.1529716@news.skynet.be>

Greg Bacon wrote:

>For example, particularly shitty mail clients (Outlook not so
>good! :-) choke on valid mboxes.
>
>This admittedly doesn't have much to do with Perl.

I think the general policy is to consider Microsoft bashing always on
topic.  ;-)

	Bart.


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

Date: 8 Jul 1999 21:16:45 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: I need to hide the source
Message-Id: <7m34ft$qna$1@info2.uah.edu>

In article <37890eb6.1529716@news.skynet.be>,
	bart.lateur@skynet.be (Bart Lateur) writes:
: I think the general policy is to consider Microsoft bashing always on
: topic.  ;-)

I'll drink to that! :-)

Greg
-- 
The O-O languages give you more of course - prettier syntax, derived types and
so on - but conceptually they provide little extra.
    -- Rob Pike


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

Date: Thu, 08 Jul 1999 16:59:49 -0400
From: cdward@NOSPAMiname.com (Charles Dexter Ward)
Subject: Re: Language-Suck-O-Meter ?
Message-Id: <cdward-0807991659500001@s06-pm02.atlanta3.campuscwix.net>

In article <7m2fp6$1lke@fidoii.cc.Lehigh.EDU>, "Stephen O. Lidie"
<lusol@Pandora.CC.Lehigh.EDU> wrote:

> John Robson <as646@FreeNet.Carleton.CA> wrote:
> 
> > Could someone tell me where is the 'Language-Suck-O-Meter' site that used
> > to be on the old host of The Perl Journal (www.tpj.com) ??
> 
> > Ever since TPJ was taken over by EarthWeb and hosted on the the
> > itknowledge.com/tpj/ , some of the cool links were gone.
> > I miss the language-suck-meter ... I used it to show my boss and
> > colleagues live feedback on how cool Perl is in comparison to other
languages.
> 
> > Could someone at EarthWeb put it back ?  Or could someone out there take
> > it over and tell me where it is ?
> 
> Yes, I love that page.  Hey, do what I just did: try to go there, get their
> missing link page, and report it to them.  On second, thought, don't do
> that.  Hopefully, 1 report is enough.

I had no idea what you two were talking about, but I did a search on
google and came up with this:

http://orwant.www.media.mit.edu/tpj/rules

HTH, but interesting to me if it doesn't.


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

Date: Thu, 08 Jul 1999 21:30:13 GMT
From: GJ <gj_at_work@my-deja.com>
Subject: Microsoft Word -> TXT?
Message-Id: <7m358l$nqu$1@nnrp1.deja.com>

     Is there anyway to open a Microsoft Word document in a perl script
and be able to get out just the text (and possibly the formating) so
that it can be formated into HTML?
Thanks.
GJ


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


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

Date: Thu, 08 Jul 1999 16:43:15 -0400
From: Heather Wiley <heather.wiley@bentley.com>
Subject: Newbie assoc array question
Message-Id: <37850D63.7E4BDB5E@bentley.com>

I am familiar with awk and I know that if you test for the existence of
an element
in an associative array incorrectly , you actually create that "element"
in the array
How do you test for the existence of a key in an array?

Ex in awk
   Load array
                array[$1]=$2
   Test for existence
                if ( x in array) ....

thanks
heather




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

Date: Thu, 08 Jul 1999 21:51:07 GMT
From: qingshan@my-deja.com
Subject: output from cgi to webpage
Message-Id: <7m36g6$oc8$1@nnrp1.deja.com>

I have a problem-

The webpage calls a cgi script, sometimes it should update that page.
But sometimes there shouldn't be any change.  If I don't output
anything from the script, there will be a "no data" popup window.
If I output "Status =Status:304 Not Modified", the page will be
overwriten with blank.  Is there anyway I can leave the original page
untouched, if I want to.

Please help.  Thanks much.


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


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

Date: Thu, 08 Jul 1999 20:56:49 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Pattern match counting
Message-Id: <378a0f6c.1711957@news.skynet.be>

Greg Bacon wrote:

> What's hard to understand about the following?
>
>    $count = () = $str =~ /pattern/g;
>
>Being able to force list context is useful.  Look at the big picture.

Problem with this hack, is that it doesn't work properly with split().
This function has a ahbit of splitting in one more field than requested,
which, in this case, is one more than zero.

	$_='me:myself:I';
	$count = () = split /:/;
	print $count;	--> 1

BTW this gives the correct answer, but also a warning about implicit
splitting to @_:

	$count = split /:/;

I wish there was a /real/ counterpart for scalar().

	Bart.


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

Date: 8 Jul 1999 21:24:48 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Pattern match counting
Message-Id: <7m34v0$qna$2@info2.uah.edu>

In article <378a0f6c.1711957@news.skynet.be>,
	bart.lateur@skynet.be (Bart Lateur) writes:
: Greg Bacon wrote:
: 
: > What's hard to understand about the following?
: >
: >    $count = () = $str =~ /pattern/g;
: >
: >Being able to force list context is useful.  Look at the big picture.
: 
: Problem with this hack, is that it doesn't work properly with split().
: This function has a ahbit of splitting in one more field than requested,
: which, in this case, is one more than zero.
: 
: 	$_='me:myself:I';
: 	$count = () = split /:/;
: 	print $count;	--> 1

The doc on split() says

    If LIMIT is unspecified or zero, trailing null fields are stripped.

which doesn't imply a limit.  Note, however, that

    $count = () = split /:/, $_, -1;

puts the count in $count as expected.

: I wish there was a /real/ counterpart for scalar().

C<$scalar = () = ...> is real enough for me.

Greg
-- 
Christ died for our sins. Dare we make his martyrdom meaningless by not
committing them? 
    -- Jules Feiffer


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

Date: 08 Jul 1999 15:51:58 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: Perl - problem with 'open'
Message-Id: <a1pv22ex7l.fsf@cyclone.jprc.com>

"Daniel De Mesmaeker" <demesmaeker@euroargus.be> writes:

> My script is :
> Open(<GET>,"abc |");
> { WHILE(<GET>);
> Print "$_ \n";
> }
> close(<GET>)
Who told you to do 'Open', 'WHILE', and 'Print'?
Perl is case-sensitive.

---Jason


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

Date: Thu, 8 Jul 1999 20:10:33 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: Perl - problem with 'open'
Message-Id: <378a03e0.28248839@newshost.unx.sas.com>

On Thu, 8 Jul 1999 21:41:17 +0200, "Daniel De Mesmaeker"
<demesmaeker@euroargus.be> wrote:

>I have a file named "abc" for example, that has the command "snmpwalk
>100.100.100.100 glspb 2.2.1".

>I would like to run this command and analyse the result.

>My script is :
>Open(<GET>,"abc |");
>{ WHILE(<GET>);
>Print "$_ \n";
>}
>close(<GET>)

>But, I don't receive anythink.
>Thank you for your quick response.

I don't believe this works.  There is no "Open" function, only
"\lopen", or in other words "open".  Same for Print.

Maybe you could buy a book on how to program perl and read it.  But
for now look at this:

# begin

open(GET,"abc") or die("I couldn't find abc.  It is your fault.");
while(<GET>) {
	chomp;
	$result = `$_`; # this will run the command and store it in
result
	print "HA HA HA IT DIDN'T WORK" if ($? ne 0);
	do_something_with($result);
}
close GET;
__END__

-- 
John Borwick


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

Date: Thu, 8 Jul 1999 15:52:21 -0500
From: "Paul Glidden" <paul.glidden@unisys.com>
Subject: Re: Perl - problem with 'open'
Message-Id: <7m3326$p8j$1@bbnews1.unisys.com>

I am assuming the file is an executable, in which case you can not open the
file to receive output from the file.  Much like C++ the open command is to
get the contents of a file.

The file needs to be executed using the eval or system command, depending
upon your usage of the return value of the file.

Each of these things would be described in great detail in a perl book or
the perl documentation.

Daniel De Mesmaeker wrote in message <7m2ueq$be2$1@news0.skynet.be>...




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

Date: Thu, 8 Jul 1999 15:23:51 -0500
From: elaine ashton <elaine@chaos.wustl.edu>
Subject: Re: Perl Installation errors on Solaris 2.5 system
Message-Id: <Pine.GSO.4.05.9907081508130.21584-100000@chaos.wustl.edu>

> While trying to configure perl using the -des extensions I got this error:

By this do you mean that you used "sh Configure -des" to run configure? 

This accepts all of the default configurations.

On 2.7 with gcc 2.8.1 Perl compiles just fine.

Possible problems are either the compiler (2.7.x is known to be a bit
buggy) or the defaults don't work for your system.

You might read through the INSTALL document in the source.

enjoy.

e.



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

Date: Thu, 08 Jul 1999 14:58:51 -0600
From: "Kerry J. Cox" <kjcox@vii.com>
Subject: Pipe mail into flat database file
Message-Id: <3785110B.787AE5AF@vii.com>

Right now I'm using cgiemail-1.6 to pipe email from off a web page into
an email account.  What I would really like to do is pipe the info into
a flat database file.  Every succeeding email would then append itself
to the end of the file.
Does anyone know of a good script that will accomplish this?  I'm open
to all suggestions.  I know about 1/3 of what I need to know in order to
get this to work.  Thanks.
Please email me as well if anyone has an answer.

KJ

--
 .-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
| Kerry J. Cox          Vyzynz International Inc.       |
| kjcox@vii.com         Systems Administrator           |
| (801) 596-7795        http://www.vii.com              |
| ICQ# 37681165         http://quasi.vii.com/linux/     |
`-------------------------------------------------------'





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

Date: 8 Jul 1999 21:55:00 GMT
From: Jonesy <jonesy@rmi.nospam.net>
Subject: Re: Pipe mail into flat database file
Message-Id: <7m36nk$m73$1@news1.rmi.net>

Kerry J. Cox <kjcox@vii.com> wrote:
> a flat database file.  

This be an oxymoron.

> | kjcox@vii.com         Systems Administrator           |

Indeed!

-- 
176 days to go until the Year 2000 -- So what!
542 days to go until the 3rd Millennium of the C.E.



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

Date: Thu, 08 Jul 1999 12:09:46 -0800
From: lglenn <larry@ldis.com>
Subject: Self-referencing hash? Ick?
Message-Id: <931464587.19958@www.remarq.com>

Hi:

In a script I'm writing, I'd kind of like to do something
like this:

my %map;
%map = ( foo => \%map, bar => 'hi' );

 ...which does work (i.e. $map{foo}->{bar} evaluates to 'hi'
- on my machine, anyway).

My question is, is this undefined behavior, or is it OK?

Oh , and for the sake of bandwidth conservation, let's just
assume that I have a perfectly valid reason for wanting to
do something this silly looking... :)

TIA,

Larry Glenn



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


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

Date: 8 Jul 1999 15:48:53 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Self-referencing hash? Ick?
Message-Id: <37851cc5@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, lglenn <larry@ldis.com> writes:
:My question is, is this undefined behavior, or is it OK?

It would have been faster to test it than to post.

--tom
-- 
    Be consistent.
            --Larry Wall in the perl man page 


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

Date: Thu, 08 Jul 1999 14:24:57 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Time calculations in Perl for Win32
Message-Id: <37851729.35B1448C@mail.cor.epa.gov>

Victor Hannak wrote:
> 
> A more advanced time question:
> 
> Is there a function for Perl Win32 that allows you to determine if a given
> time is between certain hours of any day?

Look at localtime() in list context.  It produces [among other
variables], the hour, minute, and second.  That will let you
compare a given time against lower and upper bounds, using
just an if statement or three.

To do more work with dates and times, you can check out the
Date::* modules.  Look at Date::Calc and Date::Manip first.
 
> Thanks

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


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

Date: Thu, 08 Jul 1999 17:26:55 -0400
From: Don Estes <djestes@bellsouth.net>
Subject: toturial
Message-Id: <3785179F.BFF90465@bellsouth.net>

I know this might seem a dumb question, but keep in mind we were all new
at this once.  Is there a web site that has every perl element or a site
that teaches advanced perl?
Thank you for the help,
Josh



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

Date: 8 Jul 1999 20:57:14 GMT
From: klassa@aur.alcatel.com (John Klassa)
Subject: using MIME::* to analyze email
Message-Id: <7m33ba$1rm$1@aurwww.aur.alcatel.com>

I'm trying to use MIME::Parser, MIME::Entity and the like to emit the
contents of an arbitrary mail message (possibly MIME encoded) in a standard
sort of way.  In particular, I'd like to get rid of quoted-printable
encodings and so forth, and just wind up with all of the message segments
on stdout, as plain text as can be, so that the message can bed fed into
something else.

What I can't seem to get at is nested subparts.  I've got a message that
with exmh (for example) shows up with a part 1, a part 2, a part 2.1.1, a
part 2.1.2 and so on.  When I run the message through the attached code, it
comes up as having just two parts.

I've tried looking at the preamble and epilogue, and various other things,
but it just doesn't seem to work.  So, exmh is broken and the message
really doesn't have subparts, or perhaps exmh is too lenient and is
interpreting something that it shouldn't, just to be nice.  Or perhaps, the
message is just plain broken.

Has anyone got working code that does this sort of thing?  Perhaps just a
message analyzer, that tells you what parts are where, and what they
consist of?

Thanks,
John

--%<-- sample code --%<--

open INP, shift or die "Couldn't open file: $!\n";

my $parser = new MIME::Parser;
my $entity = $parser->read(\*INP);
my @parts  = $entity->parts;

print $entity->head->as_string, "\n";

print "Number of parts: ", scalar @parts, ".\n";

if (@parts)
{
    my $idx = 0;

    for my $part (@parts)
    {
	print "\n=== MIME Part ", ++$idx, " === ";
	print "(", scalar $part->parts, " parts)\n\n";
	my $bio  = $part->open("r");
	while (defined(my $line = $bio->getline)) { print $line }
    }
}
else
{
    my $body = $entity->bodyhandle;
    my $bio  = $body->open("r");
    while (defined(my $line = $bio->getline)) { print $line }
}

$entity->purge;

-- 
John Klassa / Alcatel USA / Raleigh, NC, USA


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

Date: Thu, 8 Jul 1999 17:42:21 -0400
From: Andrew Singer <als48@pantheon.yale.edu>
To: Andrew Levi Singer <andrew.singer@yale.edu>
Subject: Which is better, Oracle or Sybase?
Message-Id: <Pine.GSO.4.10.9907081739530.4734-100000@mercury.cis.yale.edu>

Hey, I'm a Yalie interning for Trade Show News Network.  I've been 
assigned to determine which database my company should choose:  Oracle or
Sybase.  If anyone has any tips or advice, I will gladly forward you 
information about TSNN, which is at www.tsnn.com, fyi, to help you 
determine what kind of a company we are, how many hits we receive, etc.

Thank you so much!!!

-Andy

ps.  Thanks for helping me out with recommendations as to whether Perl was
better than Cold Fusion, Zope, PHP and other database-interaction
programming languages for creating dynamic web pages.

___________________________________________
Andrew Singer
300 W 108 St, Apt 1A
NY, NY 10025
(212)864-3515




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

Date: 8 Jul 1999 21:47:41 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Which is better, Oracle or Sybase?
Message-Id: <7m369t$qu9$2@info2.uah.edu>

In article <Pine.GSO.4.10.9907081739530.4734-100000@mercury.cis.yale.edu>,
	Andrew Singer <als48@pantheon.yale.edu> writes:
: Hey, I'm a Yalie interning for Trade Show News Network.  I've been 
: assigned to determine which database my company should choose:  Oracle or
: Sybase.

What in the world does this have to do with Perl?

Go back to news.announce.newusers and read everything there before you
post again.

Greg
-- 
A lot of people mistake a short memory for a clear conscience. 
    -- Doug Larson


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

Date: Thu, 08 Jul 1999 21:53:20 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Which is better, Oracle or Sybase?
Message-Id: <37851D9B.A9B64719@home.com>

Andrew Singer wrote:
> 
> If anyone has any tips or advice, I will gladly forward you
> information about TSNN, which is at www.tsnn.com, fyi, to help you
> determine what kind of a company we are, how many hits we receive, etc.

Translation:  If you answer my off-topic question, I will reward you
with spam.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 8 Jul 1999 17:03:54 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Which is better, Oracle or Sybase?
Message-Id: <slrn7oa81j.vka.abigail@alexandra.delanet.com>

Andrew Singer (als48@pantheon.yale.edu) wrote on MMCXXXVII September
MCMXCIII in <URL:news:Pine.GSO.4.10.9907081739530.4734-100000@mercury.cis.yale.edu>:
\\ Hey, I'm a Yalie interning for Trade Show News Network.  I've been 
\\ assigned to determine which database my company should choose:  Oracle or
\\ Sybase.  If anyone has any tips or advice, I will gladly forward you 
\\ information about TSNN, which is at www.tsnn.com, fyi, to help you 
\\ determine what kind of a company we are, how many hits we receive, etc.

Well, I have an opinion about that, but I'm biased. Besides, shouldn't
you ask this in database advocacy group? It doesn't have anything to do
with Perl.



Abigail
-- 
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / 
         % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
         BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'


  -----------== 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: 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 82
************************************


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