[13901] in Perl-Users-Digest

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

No subject found in mail header

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 10 17:44:58 1999

Date: Tue, 9 Nov 1999 15:20:34 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942189634-v9-i1331@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 9 Nov 1999     Volume: 9 Number: 1331

Today's topics:
        Scoping <balance08@bow.intnet.mu>
    Re: Scoping <cassell@mail.cor.epa.gov>
    Re: Scoping (Matthew Bafford)
    Re: Scoping (Abigail)
    Re: Scoping <jll@skynet.be>
        Search and Repalce a <TAB> in a string?? <jason@netralink.com>
    Re: Search and Repalce a <TAB> in a string?? <koharik@primenet.com>
    Re: Search and Repalce a <TAB> in a string?? <cassell@mail.cor.epa.gov>
    Re: Search and Repalce a <TAB> in a string?? <r28629@email.sps.mot.com>
    Re: Search and Repalce a <TAB> in a string?? <stampes@xilinx.com>
    Re: Search and Repalce a <TAB> in a string?? <sp00fD@yahoo.com>
        server access <g-preston1@ti.com>
    Re: server access <sjohns17@uic.edu>
    Re: server access <gellyfish@gellyfish.com>
    Re: server access <flavell@mail.cern.ch>
    Re: setting environment variables <dan@tuatha.sidhe.org>
        Sharp PERLers needed - San Diego company. michaelreed647@my-deja.com
    Re: Sharp PERLers needed - San Diego company. <latsharj@my-deja.com>
    Re: sizeof($myvar) in perl? <dan@tuatha.sidhe.org>
        Style Q: Any cleaner way to check uid than this? tsreyb@my-deja.com
    Re: Style Q: Any cleaner way to check uid than this? raju_k@iname.com
    Re: Style Q: Any cleaner way to check uid than this? (Alan Curry)
    Re: Style Q: Any cleaner way to check uid than this? <emschwar@rmi.net>
    Re: symbolics was [Re: FAQ 5.5: How can I manipulate fi <cassell@mail.cor.epa.gov>
        Threading <balance08@bow.intnet.mu>
    Re: Threading <cassell@mail.cor.epa.gov>
    Re: Threading (Matthew Bafford)
    Re: Using Perl on an NT Platform patelni101480@my-deja.com
        Y2K and German drivers <finsol@ts.co.nz>
    Re: Y2K and German drivers (Bradley K. Sherman)
    Re: Y2K and German drivers <newsposter@cthulhu.demon.nl>
    Re: Y2K and German drivers <gellyfish@gellyfish.com>
    Re: Y2K and German drivers <gellyfish@gellyfish.com>
        YA Find/Replace newbie question <octothorpe12NOocSPAM@yahoo.com.invalid>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 9 Nov 1999 18:40:12 GMT
From: "Jean-Patrick Madelon" <balance08@bow.intnet.mu>
Subject: Scoping
Message-Id: <01bf2a16$1ce6d440$330eead4@pat>

Does Perl have lexical scoping?
Does it support call by name or call by value?
Are there parallel constructs?


Jean-Patrick.


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

Date: Tue, 09 Nov 1999 12:00:19 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Scoping
Message-Id: <38287D53.A755F09B@mail.cor.epa.gov>

Jean-Patrick Madelon wrote:
> 
> Does Perl have lexical scoping?

Yes.

> Does it support call by name or call by value?

Both.

> Are there parallel constructs?

In Perl, TMTOWTDI (There's More Than One Way To Do It).

Perhaps you would want to read the manpages which come with
Perl.  Start with:

man perl

or: 

perldoc perl

and get some guidance on other manpages available for your
study.

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


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

Date: Tue, 09 Nov 1999 21:00:09 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Scoping
Message-Id: <slrn82h2n3.2r0.*@dragons.duesouth.net>

On 9 Nov 1999 18:40:12 GMT, Jean-Patrick Madelon"
<balance08@bow.intnet.mu> was attempting to recharge the laptop battery
by typing: 
: Does Perl have lexical scoping?

Yes.

: Are there parallel constructs?

That depends on what you mean by parallel constructs.

Perhaps you should read the manual pages for Perl.

man perl

We are here to help, but you are expected to read before you post.  Most
of the messages you have posted are fully answered in the manual.

: Jean-Patrick.

--Matthew


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

Date: 9 Nov 1999 15:17:14 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Scoping
Message-Id: <slrn82h41h.6es.abigail@alexandra.delanet.com>

Jean-Patrick Madelon (balance08@bow.intnet.mu) wrote on MMCCLXI September
MCMXCIII in <URL:news:01bf2a16$1ce6d440$330eead4@pat>:
^^ Does Perl have lexical scoping?
^^ Does it support call by name or call by value?
^^ Are there parallel constructs?


Have you tried reading the manual?



Abigail
-- 
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};


  -----------== 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: 09 Nov 1999 23:46:59 +0100
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: Scoping
Message-Id: <m3k8nrz3j0.fsf@enterprise.newedgeconcept>


> Does Perl have lexical scoping?

Yes.

> Does it support call by name or call by value?

Perl supports closures and eval(). I think the only problem
you'll encounter while implementing Jensen's device in Perl will be
(reprise) that there's mor ethan one way to do it ;-)

> Are there parallel constructs?

What do you mean? Something like Smalltalk's asynchronous execution of
Blocks?

-- 

 V
VLR		Jean-Louis Leroy
 F		http://users.skynet.be/jll





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

Date: Tue, 9 Nov 1999 21:03:20 +0200
From: "Jason Rosenkowitz" <jason@netralink.com>
Subject: Search and Repalce a <TAB> in a string??
Message-Id: <809r3n$dao$1@ctb-nnrp1.saix.net>

Hi

I can't seem to find an answer to search for and replace a <TAB>.

Could someone give me an answer!!

$whereisthetab =~ tr/?????/gotit/;

Thanks

Jason




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

Date: Tue, 9 Nov 1999 12:22:01 -0700
From: Chris <koharik@primenet.com>
Subject: Re: Search and Repalce a <TAB> in a string??
Message-Id: <Pine.BSI.3.96.991109122019.9772B-100000@usr02.primenet.com>

> Date: Tue, 9 Nov 1999 21:03:20 +0200
> From: Jason Rosenkowitz <jason@netralink.com>
> 
> I can't seem to find an answer to search for and replace a <TAB>.
> 
> Could someone give me an answer!!
> 
> $whereisthetab =~ tr/?????/gotit/;

One place to look would be "perldoc perlre" but here is a simple little
(tested) example:

#!/bin/perl -w

use strict;

my $string1 = "START	TAB	TAB	TAB	END";
$string1 =~ s/\t//g;
print STDOUT $string1;

Output should yield:

STARTTABTABTABEND

-Chris



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

Date: Tue, 09 Nov 1999 12:04:43 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Search and Repalce a <TAB> in a string??
Message-Id: <38287E5B.D921B1DD@mail.cor.epa.gov>

Jason Rosenkowitz wrote:
> 
> Hi

Howdy
 
> I can't seem to find an answer to search for and replace a <TAB>.
> 
> Could someone give me an answer!!
> 
> $whereisthetab =~ tr/?????/gotit/;

$stuff =~ tr/\t/x/;    # replace each tab with the letter x

But if you want to replace tabs with multiple characters, you
will need to use s/// instead.  tr does one-character translation.

You may benefit from a simple tutorial on Perl:

http://www.netcat.co.uk/rob/perl/win32perltut.html

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


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

Date: Tue, 09 Nov 1999 14:16:57 -0600
From: TK Soh <r28629@email.sps.mot.com>
Subject: Re: Search and Repalce a <TAB> in a string??
Message-Id: <38288139.D6E0263F@email.sps.mot.com>

Chris wrote:
> 
> > Date: Tue, 9 Nov 1999 21:03:20 +0200
> > From: Jason Rosenkowitz <jason@netralink.com>
> >
> > I can't seem to find an answer to search for and replace a <TAB>.
> >
> > Could someone give me an answer!!
> >
> > $whereisthetab =~ tr/?????/gotit/;
> 
> One place to look would be "perldoc perlre" but here is a simple little
> (tested) example:
> 
> #!/bin/perl -w
> 
> use strict;
> 
> my $string1 = "START    TAB     TAB     TAB     END";
> $string1 =~ s/\t//g;
> print STDOUT $string1;
> 
> Output should yield:
> 
> STARTTABTABTABEND
> 
> -Chris

in your case, tr/// will be much more efficient:

#!/usr/bin/perl

use Benchmark;
$strg = "xxxxx\t" x 100;

timethese(20000, {
        subs => 'my $t = $strg; $t =~ s/\t//g',
        tr   => 'my $t = $strg; $t =~ tr/\t//d',
});

__END__
Benchmark: timing 20000 iterations of subs, tr...
      subs:  5 wallclock secs ( 4.89 usr +  0.02 sys =  4.91 CPU)
        tr:  1 wallclock secs ( 0.69 usr +  0.00 sys =  0.69 CPU)


-TK


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

Date: 9 Nov 1999 19:58:39 GMT
From: Jeff Stampes <stampes@xilinx.com>
Subject: Re: Search and Repalce a <TAB> in a string??
Message-Id: <809udf$9r1@courier.xilinx.com>

Jason Rosenkowitz <jason@netralink.com> wrote:
: I can't seem to find an answer to search for and replace a <TAB>.

did you look in the perlre manpage?  I see the following Line in there:

         \t          tab                   (HT, TAB)

: Could someone give me an answer!!

: $whereisthetab =~ tr/?????/gotit/;

This probably isn't doing what you think it's doing, even with the right re:

  DB<1> $whereisthetab = "a string with \t a tab in it"

  DB<2> print $whereisthetab
a string with    a tab in it
  DB<3> $whereisthetab =~ tr/\t/gotit/

  DB<4> print $whereisthetab          
a string with g a tab in it

Hmmm....maybe you should look for another perl function, which acts much LIKE tr/// but does real substitution.

-- 
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com


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

Date: Tue, 09 Nov 1999 20:49:09 GMT
From: sp00fD <sp00fD@yahoo.com>
Subject: Re: Search and Repalce a <TAB> in a string??
Message-Id: <80a1c3$fru$1@nnrp1.deja.com>

In article <809r3n$dao$1@ctb-nnrp1.saix.net>,
  "Jason Rosenkowitz" <jason@netralink.com> wrote:
> Hi
>
> I can't seem to find an answer to search for and replace a <TAB>.
>
> Could someone give me an answer!!
>
> $whereisthetab =~ tr/?????/gotit/;
>
> Thanks
>
> Jason
>
Here,

$whereisthetab = "hello     there";
$whereisthetab =~ s/\t/ you /g;

comes out as "hello you there"



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 09 Nov 1999 13:41:16 -0600
From: Jerry Preston <g-preston1@ti.com>
Subject: server access
Message-Id: <382878DC.9E8A8E4@ti.com>

Hi,

Is it possible to do a remote login?  If so how?

Thanks,

Jerry



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

Date: Tue, 9 Nov 1999 14:11:59 -0600
From: Seth David Johnson <sjohns17@uic.edu>
Subject: Re: server access
Message-Id: <Pine.A41.4.10.9911091411400.119096-100000@tigger.cc.uic.edu>

On Tue, 9 Nov 1999, Jerry Preston wrote:

> Hi,
> 
> Is it possible to do a remote login?  If so how?

telnet <host>

-Seth



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

Date: 9 Nov 1999 21:56:56 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: server access
Message-Id: <80a5b8$h9b$1@gellyfish.btinternet.com>

On Tue, 09 Nov 1999 13:41:16 -0600 Jerry Preston wrote:
> Hi,
> 
> Is it possible to do a remote login?  If so how?
> 

I tend to use telnet myself ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Tue, 9 Nov 1999 23:20:54 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: server access
Message-Id: <Pine.HPP.3.95a.991109232020.9403M-100000@hpplus01.cern.ch>

On 9 Nov 1999, Jonathan Stowe wrote:

> > Is it possible to do a remote login?  If so how?
> 
> I tend to use telnet myself ...

I'm using ssh these days wherever I can.

:-}



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

Date: Tue, 09 Nov 1999 20:17:30 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: setting environment variables
Message-Id: <uj%V3.2640$c06.22924@news.rdc1.ct.home.com>

Balaji Krishnamurthy <bakrishn@cisco.com> wrote:
>    i presume the setenv does not reflect the settings to the parent
> shell.

For non-VMS machines, this is correct.

					Dan


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

Date: Tue, 09 Nov 1999 22:21:36 GMT
From: michaelreed647@my-deja.com
Subject: Sharp PERLers needed - San Diego company.
Message-Id: <80a6pb$k51$1@nnrp1.deja.com>

Planet Earth Communications

Title: Hot Webmaster Needed for an Exploding Company.
Skills: PERL, CGI, SQL, UNIX, C/PHP/JS a plus
Location: Escondido, (North County, San Diego) CA
Area code: 760


Start: flexible/ ASAP.
Type: Full-time
Pay: Negotiable
Length: PERM


Email: mike@pec.net
Web: pec.net

Job Description:

The Alternative to the .COM is here!!!

 .WS "WorldSite" will be the buzz of the Internet starting in 4 weeks!

Check out: http://ws.pec.net now for a look at the NIC which is under
construction. (Soon to be WorldSite.ws).

Planet Earth Communications (PEC) is a fast growing, 4 year old
Internet services company in Escondido. We are getting ready to expand
from 3500 SF into a plush 12,000 SF facility in Rancho Bernardo, and
need extreme talent to help us reach our goals to compete head-to-head
with Network Solutions' .COM.

Also look at http://pec.net for an idea of some of our current,
innovative ventures, such as iPhoneBill.com.

Salary potential is UNLIMITED, and we are also perfectly poised to go
public - the goal being 2nd quarter of Y2K.

We can provide you with a casual work atmosphere (shorts and t-shirts
are fine), unlimited coffee or Mountain Dew, health benefits, and stock
options in our company. You do have to put up with some strange in
unique people, which are most of our staff of 22.

Even if you are self-taught, but LOVE PERL (especially PERL!), mySQL,
FreeBSD (and yes, some Linux too), PHP (if you know it), C (would be
very helpful for the ServerCheck.com project), and Javascript (that
would be a definite plus), then let's get in touch ASAP!

Please email me any URLs that you have developed, and as much as you
can about what you like and what you are great at.

Sincerely,
Michael Reed
CEO/CTO
mike@pec.net





Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 09 Nov 1999 22:37:51 GMT
From: Dick Latshaw <latsharj@my-deja.com>
Subject: Re: Sharp PERLers needed - San Diego company.
Message-Id: <80a7nu$kvm$1@nnrp1.deja.com>

In article <80a6pb$k51$1@nnrp1.deja.com>,
  michaelreed647@my-deja.com wrote:
> Title: Hot Webmaster Needed for an Exploding Company.
<Snip>
I have a feeling this is going to be fun.
--
Regards,
Dick


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 09 Nov 1999 20:15:43 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: sizeof($myvar) in perl?
Message-Id: <Ph%V3.2639$c06.22924@news.rdc1.ct.home.com>

Larry Rosler <lr@hpl.hp.com> wrote:

> I haven't looked into perl internals much, but I think there is no 
> distinction at all between an integer 11 and a double 11.0 .  There is a 
> distinction between a number and a string, but not between flavors of 
> numbers.  All are stored as doubles.  Yes, no?

No. There is an IV piece that stores the integer representation of a
scalar. It's used pretty much any place that perl requires an integer
(bitwise ops and suchlike things), though math's generally done with the
floating point data.

					Dan


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

Date: Tue, 09 Nov 1999 21:40:57 GMT
From: tsreyb@my-deja.com
Subject: Style Q: Any cleaner way to check uid than this?
Message-Id: <80a4d9$i9l$1@nnrp1.deja.com>

Perl doesn't have a geteuid() function, so I had
to write my own.

I'm also new to perl, and I'm curious about other
ways to accomplish what I'm doing, and improve my
perl style.

It seems to me there ought to be a neater way to
extract the uid field from output of the external
unix (Solaris 2.5.1) command "id".

The output of "id" is of the form:

uid=0(root) gid=1(other)

I'm interested in extracting just the uid portion,
i.e., the number between the first "=" and the
first "(".

Thanks,
-TR

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

sub chk_uid {

 #ANYBODY HAVE AN ALTERNATIVE TO THE NEXT FOUR LINES??
 $euid_1 = `id`;
 @euid_2 = split /=/,  $euid_1;
 @euid_3 = split /\(/, $euid_2[1];
 $euid = $euid_3[0];

 if( $euid ne $_[0] ) {
   print "\n\tERROR: script may only be run with user ID=$_[0]\n";
   die;
 }
}

chk_uid "0";


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 09 Nov 1999 22:00:06 GMT
From: raju_k@iname.com
Subject: Re: Style Q: Any cleaner way to check uid than this?
Message-Id: <80a5h4$j61$1@nnrp1.deja.com>



In article <80a4d9$i9l$1@nnrp1.deja.com>,
  tsreyb@my-deja.com wrote:
> Perl doesn't have a geteuid() function, so I had
> to write my own.

  [ snip, snip, snip ]

>  #ANYBODY HAVE AN ALTERNATIVE TO THE NEXT FOUR LINES??
>  $euid_1 = `id`;
>  @euid_2 = split /=/,  $euid_1;
>  @euid_3 = split /\(/, $euid_2[1];
>  $euid = $euid_3[0];

Perl stores the uid in the special variable $< and
the effective uid in $> have a look at the 'perlvar'
man pages for the special variables ...

but just in case you're still interested ... you can extract the uid
with the following (of course, this depends on the format of the string
'id' returns):

($euid = `id`) =~ s/^uid=(\d+).*\s+/$1/;

--raju



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 09 Nov 1999 22:40:28 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Style Q: Any cleaner way to check uid than this?
Message-Id: <wp1W3.61798$23.2386065@typ11.nn.bcandid.com>

In article <80a4d9$i9l$1@nnrp1.deja.com>,  <tsreyb@my-deja.com> wrote:
>Perl doesn't have a geteuid() function, so I had
>to write my own.

print $>;
-- 
Alan Curry    |Declaration of   | _../\. ./\.._     ____.    ____.
pacman@cqc.com|bigotries (should| [    | |    ]    /    _>  /    _>
--------------+save some time): |  \__/   \__/     \___:    \___:
 Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman


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

Date: 09 Nov 1999 15:45:06 -0700
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Style Q: Any cleaner way to check uid than this?
Message-Id: <xkf7ljrb7yl.fsf@valdemar.col.hp.com>

tsreyb@my-deja.com writes:
> Perl doesn't have a geteuid() function, so I had
> to write my own.

What's wrong with $< and $> ?  Or am I missing something?

-=Eric
-- 
"Cutting the space budget really restores my faith in humanity.  It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
                -- Johnny Hart


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

Date: Tue, 09 Nov 1999 11:36:45 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: symbolics was [Re: FAQ 5.5: How can I manipulate fixed-record-length files?]
Message-Id: <382877CD.F301C674@mail.cor.epa.gov>

lee.lindley@bigfoot.com wrote:
> 
> David Cassell <cassell@mail.cor.epa.gov> wrote:
[snip]
> :>Isn't this A Bad Thing (tm) when we tell people that symrefs
> :>are 'okay' in a small program? ...
[more snips]

> To play the devils advocate, if you want to use symbolic references,
> that is your business.  They exist in the language.  There are better
> ways to do things now, but the useage of symbolic references is not
> yet "deprecated" (unless you count the treatment under the "use
> strict" pragma that way, but that is self imposed).

I have played with symrefs [JAPHs only :-].  But I do not
believe that it is a good idea to tell people that they are okay
in the FAQ.  Letting people shoot themselves in the foot is
one thing - Perl is good at that.  Telling them something
which is flatly contradicted elsewhere in the FAQ is something
else.

> This particular example could be re-written with a hash slice
> assignment.  IMO, there could stand to be a few more examples of hash
> slices in the documentation, so if you are volunteering to rewrite
> this FAQ entry then give it a shot and submit it to Tom C instead of
> just sending him a complaint about it, which BTW, is unlikely to move
> him.
[snip]
> @varnames = qw!pid tt stat time command!;
> ...
> while (<PS>) {
>     @psdata{@varnames} = unpack($PS_T, $_);
>     for $var (@varnames) {
>         print "$var: $psdata{$var}\n";
> ...
[snip]

Hey thanks!  Now that you've written it, are you going to
send it to TomC so I don't have to do that part either?  :-)

> Can anyone list a "good" time to use symbolic references in Perl 5
> for some better definition of good than the above example?  I have a
> feeling that there really is a time to use them, but I can't think of
> any off of the top of my head.

It's an excellent way to sneak subtle bugs into your code,
so that you can have job security.  :-)

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


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

Date: 9 Nov 1999 18:43:15 GMT
From: "Jean-Patrick Madelon" <balance08@bow.intnet.mu>
Subject: Threading
Message-Id: <01bf2a16$8a0e3fe0$330eead4@pat>

Is Perl multi threaded?



Jean-Patrick.


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

Date: Tue, 09 Nov 1999 12:01:59 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Threading
Message-Id: <38287DB7.F2B95938@mail.cor.epa.gov>

Jean-Patrick Madelon wrote:
> 
> Is Perl multi threaded?

Yes, if you compile it that way.  But I wouldn't say that Perl's
threads are robust yet.  Consider other ways of doing the same
tasks in Perl - there are already alternatives. 

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


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

Date: Tue, 09 Nov 1999 21:00:04 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Threading
Message-Id: <slrn82h2ic.2r0.*@dragons.duesouth.net>

And so it happened, on 9 Nov 1999 18:43:15 GMT, Jean-Patrick Madelon"
<balance08@bow.intnet.mu> typed random characters into perl, and ended
up with the following posted to comp.lang.perl.misc: 
: Is Perl multi threaded?

That question is ambiguous.

That question also depends on how you compiled Perl.

Perhaps you should read the manual pages for Perl.

man perl

We are here to help, but you are expected to read before you post.  Most
of the messages you have posted are fully answered in the manual.

: Jean-Patrick.

--Matthew


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

Date: Tue, 09 Nov 1999 19:05:14 GMT
From: patelni101480@my-deja.com
Subject: Re: Using Perl on an NT Platform
Message-Id: <809r8t$ao6$1@nnrp1.deja.com>

In article <38239d00.3496708@news3.ibm.net>,
  jand@activestate.com (Jan Dubois) wrote:
> [mailed & posted]
>
> patelni101480@my-deja.com wrote:
>
> >I am trying to get Perl to use the NT command called shutdown.  This
> >command allows me to shutdown other computers on a network.  In Perl
I
> >know there is a command called system, that would let me use
shutdown.
> >But when I try to use it, it gives me all the different shutdown
> >options, it won't actually shutdown the machine.  I can shutdown my
own
> >local computer, but I can't shutdown other computers on a network.
> >Anyone have any suggestions???
>
> Show us some code!  Did you forget to double backslashes inside ""
strings?
>
> Do you know that the Win32 module contains a
Win32::InitiateSystemShutdown
> function?  Read about it in `perldoc Win32`:
>
> Win32::InitiateSystemShutdown(MACHINE, MESSAGE, TIMEOUT, FORCECLOSE,
REBOOT)
>         [EXT] Shutsdown the specified MACHINE, notifying users with
>         the supplied MESSAGE, within the specified TIMEOUT interval.
>         Forces closing of all documents without prompting the user
>         if FORCECLOSE is true, and reboots the machine if REBOOT is
>         true. This function works only on WinNT.
>
> Don't forget the "use Win32;" statement should you choose to try this
> function.
>
> -Jan
>

I used the following code when I did this, and it tells me it is looking
for the plugin.

$reboot=false;

use Net::Ping;
$Ping=Net::Ping->new(icmp);

use Win32::InitiateSystemShutdown;
$Shutdown=Win32::InitiateSystemShutdown->(icmp);

foreach $ws (@ws) {
#Calls on the workstation I made in an ini file

   if ($Ping->ping($ws,2)) {
      print ("\nCan ping Workstation $ws OK \n");
          $reboot=true;
   } else {
      print ("\n$ws apears to be off the network\n");
   }

	if ($reboot = true) {
		$Shutdown;
	}

Any suggestions anyone???

Thank You,
NiraV


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 09 Nov 1999 19:11:11 GMT
From: Jocelyn Amon <finsol@ts.co.nz>
Subject: Y2K and German drivers
Message-Id: <809rk2$b51$1@nnrp1.deja.com>

In article <dNKV3.10$kK3.2397@vic.nntp.telstra.net>,
  "Wyzelli" <wyzelli@yahoo.com> wrote:
> Jocelyn Amon <finsol@ts.co.nz> wrote in message
> news:7vv80o$26v$1@nnrp1.deja.com...
> > In article <01bf2714$c32e8be0$3527e1ce@bill.jump.net>,
> >   "William" <bivey@teamdev.com> wrote:
> > <SNIP>
> > >
> > >
> > It is not uncommon for programmers to learn from looking at existing
> > code - correct?  So, why would they need to query localtime usage
when
> > they see it already used in code and they can see quite clearly how
the
> > year value is extracted?  Why would they have any reason to think
they
> > would need to refer to the manual?  Maybe programmers 'should' learn
> > from the manual but my guess is that the vast majority learn by
example
> > - not by referring to the manual every time they need to code
something
> > just slightly unfamiliar. That is the real world of programming.
Where
> > do you work - in an ivory tower?
>
> Absolutely, and I learnt to drive by watching other drivers.  Only the
best
> too.  F1GP drivers.  Trouble is all the other drivers who keep getting
in my
> way reckon it's my fault for not learning how to drive properly!  So I
> watched some ordinary drivers for a while.  In a country where they
are car
> mad, so they must know how to drive.  So now when I drive on the right
hand
> side of the road in NZ I keep having silly fools yelling at me "Learn
to
> Drive".
>
> What could I be doing wrong?
>
> Road Rules?  Manual?  What?  Just learn by copying!
>
Its not a matter of yelling at the wrongdoers to do things correctly -
it is a matter of accepting that they may get it wrong. And to check all
mission critical code.  As a secondary issue, maybe we should also be
working towards changing in the way we programmers learn and how
we do things - e.g. the lack of peer review, the lack of standards etc.
But in my many years of programming I have found very little acceptance
of these radical ideas amongst programmers.  It will take some
catastrophic event for them to change or for others to impose change
upon them.

Your analogy regarding driving on the correct side of the road is a good
one.  We have a very real problem with this where I live in Nelson,
located in the south island of New Zealand.  It mostly relates to German
tourists driving on the wrong side of the road.  Yes, they know we drive
on the left but there is a problem that when they pull out of a service
station onto an empty road they may have a lapse of memory as to where
they are and what the rules are so they can go into automatic mode and
move to the incorrect side of the road - sometimes with fatal results -
for them and for locals.  Are they stupid? No. They are just human.

We recognise this problem and so in some areas they place signs with
"LEFT" (in German) at the danger spots on the roads.

I had an experience awhile back which is very similar to current
programmer reaction to the Y2K problem.  A German friend's brother
arrived with his family for a self-drive tour around the south island of
New Zealand - this is the area which experiences the most problems with
drivers on the wrong side due to the empty highways.  I mentioned to him
to be careful about keeping to the left as it was a known problem.  He
was most affronted that I would think that he did not already know that
this was the rule in this country.  His limited English made it
difficult for me to explain the subtlety of the problem and his sister
was not around to help me with translation. I didn't see him again after
that as he was just passing through my city but his sister told me
later that he had actually made the mistake a few days later.  He was
able to correct it before an accident happened.  He now understood what
is was I was trying to say.  He probably also realised that it was no
criticism of him that I was saying it.

I do, however, criticise him for his initial arrogance. It could have
cost him his life, the lives of his family and the lives of others on
the road.  All because he could not consider for a moment that he could
possibly make a mistake - after all he knew the rules!

Just as we all know the year 2000 is next year.

So, there is a example of how arrogance can blind you into thinking that
there is nothing more to be learnt.
Jocelyn


--
http://www.ts.co.nz/~finsol/


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 9 Nov 1999 19:32:42 GMT
From: bks@netcom.com (Bradley K. Sherman)
Subject: Re: Y2K and German drivers
Message-Id: <809ssq$l6f$1@nntp5.atl.mindspring.net>

Jocelyn Amon  <finsol@ts.co.nz> wrote, on 21 Oct 99:

| For well over a year now I have been working on Y2K
| awareness within the computer industry both here in
| New Zealand and internationally.
| 					     
| Recently I decided that further work on this would
| be a waste of time. I feel its too late now for me to
| make any difference to what may or may not happen to
| computers when the century roll-over occurs.
(http://x36.deja.com/getdoc.xp?AN=538729429&CONTEXT=942175464.865402945&hitnum=2)

Thanks for all your work on the Perl question, Jocelyn.
Sorry you felt that you had to break away from your local
labours to inform the Perl programmers that there is bad
code on the Web.

Any news on the make and model of the Washing Machine that has
a Y2k problem? (http://www.idg.co.nz/wwwfeat/Y2000/ja250199.htm)
Surely in a year you've been able to nail down a few real examples.

    --bks



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

Date: 9 Nov 1999 19:46:43 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Y2K and German drivers
Message-Id: <809tn3$87r$1@internal-news.uu.net>

In comp.lang.perl.misc Bradley K. Sherman <bks@netcom.com> wrote:

> Any news on the make and model of the Washing Machine that has
> a Y2k problem? (http://www.idg.co.nz/wwwfeat/Y2000/ja250199.htm)
> Surely in a year you've been able to nail down a few real examples.

Last week I was at my parents home. I forgot to check the washing
machine, but at least the timer is mechanical *phew*.

Erik



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

Date: 9 Nov 1999 20:45:16 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Y2K and German drivers
Message-Id: <80a14s$h8b$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Jocelyn Amon <finsol@ts.co.nz> wrote:

<snipped as someones wrapping had gone beyond remedy>

> Its not a matter of yelling at the wrongdoers to do things correctly -
> it is a matter of accepting that they may get it wrong. And to check all
> mission critical code.  

Oh sure Jocelyn - this 'mission critical code' you've been banging on
about on your web page - burning up Altavista, these 'mission critical'
guestbooks and 'mission critical' message boards on these skript kiddie
web sites that are going to display 01/01/19100 at the beginning of the
month of the next.  You have been challenged  before to demonstrate some
serious Perl code made by a real programmer that exhibited this misuse of
(localtime)[5] and I do so again.

>                        As a secondary issue, maybe we should also be
> working towards changing in the way we programmers learn and how
> we do things - e.g. the lack of peer review, the lack of standards etc.
> But in my many years of programming I have found very little acceptance
> of these radical ideas amongst programmers.  It will take some
> catastrophic event for them to change or for others to impose change
> upon them.
> 

I feel the frustration of a great visionary thwarted - I am now beginning
to get a handle on your animus toward programmers...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 9 Nov 1999 20:58:20 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Y2K and German drivers
Message-Id: <80a1tc$h8f$1@gellyfish.btinternet.com>

In comp.lang.perl.misc Bradley K. Sherman <bks@netcom.com> wrote:
> 
> Thanks for all your work on the Perl question, Jocelyn.

'The Perl Question' ? I get an uneasy feeling - 'Programmer Denialists' I
recall from earlier in this thread ... Is there a social anthropologist
with an interest in linguistics and an understanding of history in the house ?
I feel the roots of a rather nasty blame culture developing here.

> Sorry you felt that you had to break away from your local
> labours to inform the Perl programmers that there is bad
> code on the Web.
> 

We're sorry too - I believe that all Jocelyn has done is irritate people
and waste here time tracking down a bunch of code that is demonstrably
bad by any criteria which everyone knew about anyway ...

> Any news on the make and model of the Washing Machine that has
> a Y2k problem? (http://www.idg.co.nz/wwwfeat/Y2000/ja250199.htm)
> Surely in a year you've been able to nail down a few real examples.
> 

Oh lawdy ... 

Please keep this stuff to yourselves.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Tue, 09 Nov 1999 13:12:01 -0800
From: visigothe <octothorpe12NOocSPAM@yahoo.com.invalid>
Subject: YA Find/Replace newbie question
Message-Id: <0a0133f8.634f6d1b@usw-ex0106-041.remarq.com>

Hello all;

First things first; I have read quite a lot of the archives and I can't
quite seem to find the answer to my problem. I also tried news.answers
for the FAQ, but to no avail.

I am attempting to write a script that opens an existing html file,
searches for a specific string "<!--Begin Content Section-->" [also
referred to internally as "$nukeme"] and replaces that string with a
template filled with captured form data. Then the file is promptly
rewritten, ready to be served.

Capturing the form data [and cleaning it] is not a problem. I have set
them up as variables:

$newsbr [$newsbr is actually the cleaned version of $news]
$author
and
$headline

This will allow me to slug those into my template as such [the
following resides inside the script not externally... yes they should
have print"" if I want to print them or some variable designation, but
see below]:

<!--Begin Content Section--><!--Begin box--><TABLE BORDER=0
CELLSPACING=2 CELLPADDING=3 width=99%>
<TR VALIGN=Top>
	<TD bgcolor="#C2C2CD"><FONT COLOR="#000000"><B>$headline</B>
$rday/$rmonth/$ryear</FONT></TD>
</TR>
<TR VALIGN=Top>
	<TD bgcolor="#ffffff">$newsbr
	</TD>
</TR>
</TABLE><!--end box-->

OK great. now what? Do I make the above one big variable and replace
$nukeme with $newdata?

Really silly Q; but how would I go about putting that huge textblock
into a variable? just put quotes around it and escape all the funky
chars?

Is there a better way to do all of this?

Did I thoroughly confuse anyone?

can someone float me the URI for the FAQ?

Sorry for being such an idiot, but I seem to be really close to
accomplishing what I want to, but I can't seem to find a way to do it
correctly.

Thank you in advance.

Chris Harrington,
frustrated programmer


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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


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