[8852] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2469 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 30 22:05:35 1998

Date: Thu, 30 Apr 98 19:00:31 -0700
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, 30 Apr 1998     Volume: 8 Number: 2469

Today's topics:
        (Off topic) Re: Perl/Wall lingo question <metcher@spider.herston.uq.edu.au>
    Re: 1701 days hath September (was: Re: rename funciton) <rjk@coos.dartmouth.edu>
    Re: ANNOUNCE: Perl Builder IDE Now Available lvirden@cas.org
    Re: ANNOUNCE: Perl Builder IDE Now Available (Greg Teets)
        CAN I TEST PERL SOFTWARE ON AN ORDINARY COMPUTER <dcc1234@pacific.net.sg >
    Re: CAN I TEST PERL SOFTWARE ON AN ORDINARY COMPUTER <rootbeer@teleport.com>
    Re: change a string (Martien Verbruggen)
    Re: Confusion with new warning concerning split operato (Charles DeRykus)
    Re: Confusion with new warning concerning split operato <danboo@negia.net>
    Re: Confusion with new warning concerning split operato <danboo@negia.net>
    Re: Credit Card Verification scripts? lvirden@cas.org
    Re: Dateinamen + Datum letzte Aenderung (Martien Verbruggen)
        HELP ON FILE LOCKING <dcc1234@pacific.net.sg >
    Re: HELP ON FILE LOCKING <rootbeer@teleport.com>
        HTML Builder scripts <ykaganov@usa.net>
    Re: http Reg Exp <rjk@coos.dartmouth.edu>
    Re: inline replace <rjk@coos.dartmouth.edu>
    Re: Looking for an idiom (cf. Schwartzian Transform) <jdf@pobox.com>
    Re: Looking for an idiom (cf. Schwartzian Transform) <danboo@negia.net>
    Re: Looking for an idiom (cf. Schwartzian Transform) <danboo@negia.net>
        majordomo relay ?? <dphi@ix.netcom.com>
    Re: multiple commands at the same time? (Chris Sherman)
    Re: Newbie: How do you compile a script in Perl for Win (Martien Verbruggen)
    Re: perl  -e filenamewith_regex datafiles question <rjk@coos.dartmouth.edu>
    Re: perl and Year 2000 lvirden@cas.org
        Perl compiler - I've played with it, why so slow? (Barry Roomberg)
    Re: Perl loops have me stumped for pagenumbering sequen (Martien Verbruggen)
    Re: Perl loops have me stumped for pagenumbering sequen <danboo@negia.net>
    Re: Perl web server.... <dphi@ix.netcom.com>
        push @strArray, (24..31); <webmaster@fccjmail.fccj.org>
    Re: SMTP and sockets (Martien Verbruggen)
        Win32 Perl Compiler ? <devs@usa.net>
    Re: Win32::NetResource::AddConnection exhibiting undocu (Jeffrey Drumm)
    Re: Windows/NT, Perl, and redirection <tmcanally@tkmsoftware.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 01 May 1998 11:03:33 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: (Off topic) Re: Perl/Wall lingo question
Message-Id: <35491F65.93887AC7@spider.herston.uq.edu.au>

brian d foy wrote:
> 
> 
> a one-dimensional vector, and a scalar having a dimension aren't
> mutually exclusive.  let's remember why the vector is one-dimensional -
> it holds one scalar.
> 
> but perhaps this is semantics - the definition of "dimension" differing
> between physics, math, computer science, and perl.
> 
> however, let's remember that even a simple Perl scalar is not just the
> data that it represents.  there is all sorts of other info stored with
> it to make the special Perly things happen, so in this case, a SCALAR
> is a vector! :)
> 

As I understand it:

A one dimensional vector is only equivalent to a scalar in a one
dimensional space.  In higher dimensions, scalar and vector
multiplication are two entirely different things.  For example, you
could multiply the matrix:

1 2 3
4 5 6
7 8 9

by scalar 5, but you sure can't multiply it by the vector (5).   Of
course, as far as my geometry classes told me, a one dimensional vector
can't exist in a three dimensional space.  Does anyone know of any
real-life problems where vectors of differing dimension intermingle?

Anyway, in mathematics as in perl, a vector (or array) is a vector (or
array) not because it has certain numbers of thingies, but because
different rules apply to it.

-- 
Jaime Metcher


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

Date: Thu, 30 Apr 1998 21:56:03 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <35492BB3.648A9108@coos.dartmouth.edu>

Bob Trieger wrote:
> 
> Moderation = censorship in my eye and all censorship is evil.

I'll have to remember that next time someone tries to stop me from yelling
"Fire!" in a crowded theatre.

> c.l.p.m is
> a community and we don't need some type of large government telling us
> what is ok to post and what is not. We can all do that ourselves.

Is it ok to post a message to clpm advertising a sex site?
Is it ok to post a test message to clpm when there are other newsgroups
explicitly for that purpose?
Is it ok to post a message giving an incorrect answer to a simple question
clearly answered in the documentation?
Some people tell themselves it is.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 30 Apr 1998 23:41:04 GMT
From: lvirden@cas.org
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <6ib26g$1e$1@srv38s4u.cas.org>


According to Grinch <grinch@whoville.com>:
:That's also, btw, where the mouse was invented. If I recall correctly, the
:original model had two buttons, and Apple, as usual, insisted on being
:different. ;-)

Thank goodness too - otherwise, no one in the world would be using a mouse...

-- 
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: Fri, 01 May 1998 00:14:04 GMT
From: teetshd@email.uc.edu (Greg Teets)
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <354913a5.166353495@news.ececs.uc.edu>

Perhaps I missed the original message.  Is there a Perl Builder IDE?

Thanks
Greg Teets




On 30 Apr 1998 23:41:04 GMT, lvirden@cas.org wrote:

>
>According to Grinch <grinch@whoville.com>:
>:That's also, btw, where the mouse was invented. If I recall correctly, the
>:original model had two buttons, and Apple, as usual, insisted on being
>:different. ;-)
>
>Thank goodness too - otherwise, no one in the world would be using a mouse...
>
>-- 
><URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
><*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
>Unless explicitly stated to the contrary, nothing in this posting
>should be construed as representing my employer's opinions.



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

Date: 1 May 1998 00:33:12 GMT
From: "DAVID CHEW" <dcc1234@pacific.net.sg >
Subject: CAN I TEST PERL SOFTWARE ON AN ORDINARY COMPUTER
Message-Id: <01bd7496$80e43dc0$27bd15a5@default>

Any one can help here.
At this moment, whenever I creat a perl software
I have to test it in on an external server located
in the INTERNET. This cost money as I have to 
download upload.

I am just wondering HOW to test my perl using
my home computer, running on dos or windows.
As I do not always go into this newsgroup
would appreciate an email direct
to dcc1234@pacific.net.sg

thanks
DAVID



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

Date: Fri, 01 May 1998 00:59:24 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: DAVID CHEW <dcc1234@pacific.net.sg>
Subject: Re: CAN I TEST PERL SOFTWARE ON AN ORDINARY COMPUTER
Message-Id: <Pine.GSO.3.96.980430175809.8307l-100000@user2.teleport.com>

On 1 May 1998, DAVID CHEW wrote:

> Subject: CAN I TEST PERL SOFTWARE ON AN ORDINARY COMPUTER

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> I am just wondering HOW to test my perl using
> my home computer, running on dos or windows.

Install Perl on your home computer. You'll find source or binaries on
CPAN. (Or are you asking something more complex than this?)

    http://cpan.perl.org/

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 30 Apr 1998 23:46:57 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: change a string
Message-Id: <6ib2hh$6i5$3@comdyn.comdyn.com.au>

In article <01bd743f$f5382120$840c138e@huntzige.fr_hag_01a>,
	"Zeta" <jacques.huntziger@khe.scn.de> writes:
> Hello,
> I have a little problem, I want to change in a string a / caratere, but I
> can't..
> I know that : $string =~ s/car/newcar/g;
> but for / what car use?

Please read the following:

# perldoc perlre
# perldoc perlop

$string =~ s/\//whatever/g;
$string =~ s#/#whatever#g;

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 30 Apr 1998 23:57:15 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Confusion with new warning concerning split operator in perl5.004
Message-Id: <Es93vF.FMz@news.boeing.com>

In article <3548f7eb.10426307@news.metropolis.com>,
Alex Blume <ablume@80s.com> wrote:
>Under perl 5.004_04, the following code,
>
>	#!/usr/local/bin/perl
>	$test_string = "3-4-5-6";
>	$dash_count = split(/\-/, $test_string);
>	print "String $test_string has $dash_count dashes\n";
>	exit(0);
>
>now generates the warning
>
>	Use of implicit split to @_ is deprecated at test.pl line 3.
>
>Could anyone explain this error message to me, and whether there is a
>better method to count the number of regular expression matches (in
>this case, just dashes) found in a string.
>
 
  "use diagnostics;"    # add to script for explanation below:  

   Use of implicit split to @_ is deprecated at ./tmp.perl line 4 (#1)
    
   (D) It makes a lot of work for the compiler when you clobber a
   subroutine's argument list, so it's better if you assign the results of
   a split() explicitly to an array (or list).


Actually, split will throw the dash count off by 1, eh...? 
But here are a few alternatives to just count dashes: 

   $dash_count = $test_string =~ tr/-//;        # simple, fast

   $dash_count++ while $test_string =~ m/\-/g;  # for the tr-challenged 

   $dash_count = () = $test_string =~ m/\-/g;   # for the loop-phobic  


Or, if you have to split:

   $dash_count = (@dashes = split(/\//,$test_string)) -1; 

   $dash_count = @{[split(/\//,$test_string)]} -1; 



HTH,
--
Charles DeRykus


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

Date: Thu, 30 Apr 1998 19:03:29 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Confusion with new warning concerning split operator in perl5.004
Message-Id: <35490341.9D688D3F@negia.net>

Alex Blume wrote:
> 
> Under perl 5.004_04, the following code,
> 
>         #!/usr/local/bin/perl
>         $test_string = "3-4-5-6";
>         $dash_count = split(/\-/, $test_string);
>         print "String $test_string has $dash_count dashes\n";
>         exit(0);
> 
> now generates the warning
> 
>         Use of implicit split to @_ is deprecated at test.pl line 3.
> 
> Could anyone explain this error message to me, and whether there is a
> better method to count the number of regular expression matches (in
> this case, just dashes) found in a string.

the message you are seeing is due to the split not being used in a
list context. if you wrap parens around $dash_count the error will
disappear, and you'll even have the right answer. this of course is
coincidental and i recommend the following techniques for general
purposes. ;-)

as you have already seen the count isn't even correct. if you want
to count simple characters i suggest the 'tr' (translation) operator:

$dash_count = $test_string =~ tr/-//;

to count regex matches you can use:

$dash_count++ while $test_string =~ m/-/g;

cheers,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Thu, 30 Apr 1998 20:49:21 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Confusion with new warning concerning split operator in perl5.004
Message-Id: <35491C11.C20165AD@negia.net>

Charles DeRykus wrote:
> 
[SNIP]
> >Could anyone explain this error message to me, and whether there is a
> >better method to count the number of regular expression matches (in
> >this case, just dashes) found in a string.
> >
> Or, if you have to split:
> 
>    $dash_count = (@dashes = split(/\//,$test_string)) -1;
> 
>    $dash_count = @{[split(/\//,$test_string)]} -1;

hmm?

$test_string = '-3-';
$dash_count = @{[split(/-/,$test_string)]} -1;
print "dashes: $dash_count\n";
__END__

dashes: 1

i'll stick with '$foo++ while $bar =~ m/baz/g'.

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: 1 May 1998 00:16:09 GMT
From: lvirden@cas.org
Subject: Re: Credit Card Verification scripts?
Message-Id: <6ib489$1i8$2@srv38s4u.cas.org>


According to Tom Phoenix  <rootbeer@teleport.com>:
:On Mon, 27 Apr 1998, Zisa wrote:
:> I'm 12 and have plenty of time to get it right but it wont do me any
:> good if you don't answer my questions.
:In any case, c.l.p.misc is not a help desk. If no one answers your
:questions, that's more likely to be your fault than ours! :-)

Hmm - how much do you suppose a 12 year old can afford to pay for help?

Anyone have some useful suggestions on where folk can go to ask for
help with programming problems when the language in question is Perl?

Yet again it has been hammered home that clpm is not a help desk.  Obviously
while some folk can afford to pay big bucks to get answers to questions,
others cannot.  If you know of other newsgroups or web sites where the
atmosphere is a bit more conducive for the answering of such questions,
drop me a note.

If all you have to contribute is more claims of never seeing anyone turned
away from clpm, etc. don't bother - i've seen enough of those types of
responses.
-- 
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: 30 Apr 1998 23:45:03 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Dateinamen + Datum letzte Aenderung
Message-Id: <6ib2dv$6i5$2@comdyn.comdyn.com.au>

[responding to this article, because my increasingly unreliable
newsfeed hasn't got the original yet]

In article <35477DAA.B5077556@vancpower.com>,
	Richard Tan <tanr@vancpower.com> writes:
> Arne Steinbacher wrote:
> 
>> Hallo zusammen,
>> wie bekomme ich eigentlich das Datum der letzten Aederung einer
>> beliebigen Datei heraus?
>> Danke.

[You really should post in english when you post to an international
group. If you want to post in german, post to a local group
(de.perl.misc I believe), or limit the distribution of your article]

>>
>> Arne
> 
> No can do!  Don't understand :-(

I think he's asking how he can find out the time that a file was last
modified.

If your platform provides this sort of information you can use the
perl builtin stat function

# perldoc -f stat

You could also use the -M file test, which will return the age in days

# perldoc -f -X

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 1 May 1998 00:28:24 GMT
From: "DAVID CHEW" <dcc1234@pacific.net.sg >
Subject: HELP ON FILE LOCKING
Message-Id: <01bd7495$d514c820$27bd15a5@default>

Anyone can help on this:
If A is writing on a fileX, and locks the fileX
and someone else B starts reading the  fileX,
Would B be able to read fileX correctly if fileX is locked for writing by
A.
Should B test for locking before reading fileX

As I dont often go to this newsgroup,
would appreciate if you email direct
to me at dcc1234@pacific.net.sg

THANKS
DAVID

 


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

Date: Fri, 01 May 1998 00:54:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: DAVID CHEW <dcc1234@pacific.net.sg>
Subject: Re: HELP ON FILE LOCKING
Message-Id: <Pine.GSO.3.96.980430175007.8307j-100000@user2.teleport.com>

On 1 May 1998, DAVID CHEW wrote:

> Subject: HELP ON FILE LOCKING

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> If A is writing on a fileX, and locks the fileX and someone else B
> starts reading the fileX, Would B be able to read fileX correctly if
> fileX is locked for writing by A. 

What do you mean by "correctly"? If another process is writing to the
file, it can be tricky to ensure that your process reads the data
correctly. 

> Should B test for locking before reading fileX

Almost certainly, B should obtain a lock on the file before reading.

Of course, this applies whether your code is written in Perl or in any
other language. If you have more questions about file locking which
aren't answered in your system's documentation, you should ask in a
newsgroup about your system. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 30 Apr 1998 17:20:22 -0700
From: "Y. Kaganovich" <ykaganov@usa.net>
Subject: HTML Builder scripts
Message-Id: <35491545.1B803027@usa.net>

Hi,

I'm looking for cgi form-based HTML builders, similar to Tripod's
builder to automate content upload on my company's website. We get a lot
of content from people who don't want to learn HTML, plus we would like
to enforce some layout rules. Most of the builders  I've found are way
too rigid to be of any use; I'm looking for ones that allow users to
append HTML blocks in any order. So far, the builder at
www.htmlcreator.com is the closest to what I need, but they don't seem
to give out the program to others.

Any ideas?

Thanks,

-Eugene
ykaganov@usa.net





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

Date: Thu, 30 Apr 1998 21:46:27 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: http Reg Exp
Message-Id: <35492974.BE9D678@coos.dartmouth.edu>

Earl Hood wrote:
> 
> If proper <URL:...> were to be done (ie. urls broken over multiple
> lines) along with general detection, it would complicate the filtering
> code.  If using Perl, you would have to slurp the entire file into
> memory instead of doing the more memory efficient line-by-line filtering.

Why?

Read in a line.  If it contains an unterminated '<URL:' then read in and
concatenate the next line until you find the matching '>'.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Thu, 30 Apr 1998 21:40:46 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Miten S Mehta <mehta@mama.indstate.edu>
Subject: Re: inline replace
Message-Id: <3549281E.68E8E68C@coos.dartmouth.edu>

[posted and mailed]

Miten S Mehta wrote:
> 
> 4/30/98
> 
> Hello,
> 
> I am unable to get the perl command
> perl -pi.bak -e programfile.pl datafile
               ^^^^^^^^^^^^^^^^^
> to do inline replace.  could you guide?

-e means the program will be written out on the command line.  Use it like this:

  perl -e 'print "A perl program on the command line\n"'

If your Perl program is in a file, do not use the -e option:

  perl programfile.pl

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 30 Apr 1998 17:56:34 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: mmorris@mindspring.com
Subject: Re: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <ogxiq5p9.fsf@mailhost.panix.com>

[posted and mailed]
mgm@unpkhswm04.bscc.bls.com (Mitchell Morris) writes:

> map { $_->[0] } sort { $a->[1] cmp $b->[1] }
> 	map { [ $_, s/(\d+)(\D+)/$2$1/ ] } @lines;
> 
> The difficulty is that s/// returns the number of substitutions performed,
> and what I want is the resulting string.

Which reminds me of the joke:

  Patient: "Doctor, it hurts when I do this."
  Doctor:  "So don't do that!"

Either do the sub and then use $_ as the value, or don't use
substitution.  Here's one expression of the idea:

   @stuff = 
     map {  $_->[2] }
     sort { $a->[1] cmp $b->[1] or $a->[0] <=> $b->[0] }  
     map { /^(\d*)(.+)$/; [ $1 || -1, $2, $_ ] } @stuff;

Notice that if there's no digit, I want it to come before even a 0
word, so I give it a -1 value.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Thu, 30 Apr 1998 20:29:40 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <35491774.5545B276@negia.net>

Dan Boorstein wrote:
> 
[SNIP]
> @bits = qw(Foo 0Foo 1Foo Bar 0Bar 1Bar 2Bar 12Bar 13Bar Foo);
> 
> print map  { $_->[0], "\n" }
>       sort { $a->[1] cmp $b->[1] or $a->[2] <=> $b->[2] }
>       map  { m/(\d*)(\D+)/; [ $_, $2, $1 || 0 ] }
>       @bits;
> 

and just to go a little overboard, if you wanted to do a lexical
sort on the non-digits, and then a numeric/lexical sort on the
digits you could try this:

print map  { $_->[0], "\n" }
      sort { local $^W;
             $a->[1] cmp $b->[1] or
             $a->[2] <=> $b->[2] or
             $a->[2] cmp $b->[2] }
      map  { /(\d*)(\D+)/; [ $_, $2, $1] }
      @bits;

the main difference is the passing in of digits as is, while turning
warnings off inside the sort block, and instead sorting equal digits
lexically. the assures that all your 'Foo's end up together, as
opposed to being mixed in with the '0Foo's and '00Foo's.

i'll stop now,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Thu, 30 Apr 1998 21:08:28 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Looking for an idiom (cf. Schwartzian Transform)
Message-Id: <3549208C.C9840827@negia.net>

Jonathan Feinberg wrote:
> 
> 
>    @stuff =
>      map {  $_->[2] }
>      sort { $a->[1] cmp $b->[1] or $a->[0] <=> $b->[0] }
>      map { /^(\d*)(.+)$/; [ $1 || -1, $2, $_ ] } @stuff;
> 
> Notice that if there's no digit, I want it to come before even a 0
> word, so I give it a -1 value.

don't '0's (as in '0Foo') become -1 as well?

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Thu, 30 Apr 1998 17:49:51 -0700
From: Dale Phillips <dphi@ix.netcom.com>
Subject: majordomo relay ??
Message-Id: <35491C2F.7A77@ix.netcom.com>

help ...

Is this news group relayed by some kind and friendly perl hacker?

I have problems with getting online but email seems
to work.... from fosterfarms.com 

 a lone perl voice in a whirld of windows..... :-(

-- 
--dp----------------------------------------------
Dale Phillips
phillipd@fosterfarms.com


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

Date: Fri, 1 May 1998 00:52:24 GMT
From: sherman@unx.sas.com (Chris Sherman)
Subject: Re: multiple commands at the same time?
Message-Id: <Es96FC.GEr@unx.sas.com>

In <3548C5E5.E030EADE@gmx.net> Philipp <Philipp999@gmx.net> writes:

> Does anybody know how to run multiple commands at the same time (...or
> nearly at the same time)?

GNU make does this.  Look at the -j flag.  The algorithm to do this
is pretty messy, but you can probably either use GNU make to launch
your whois' or dig at its C code to get a hit of how to do it in
perl.
-- 
     ____/     /     /     __  /    _  _/    ____/
    /         /     /     /   /      /     /          Chris Sherman
   /         ___   /        _/      /          /
 _____/   __/   __/   __/ _\    _____/   _____/           sherman@unx.sas.com


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

Date: 1 May 1998 00:33:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Newbie: How do you compile a script in Perl for Win32?????
Message-Id: <6ib57t$6pk$1@comdyn.comdyn.com.au>

In article <co121.994$v74.1476107@katana>,
	"Jonathan Burns" <JonathanBurns@onlineinfoservices.com> writes:

> I have a .pl file, but when I access it from the web, it displays the script
> as if it were a text file.  Does it need to be compiled?  How do you compile
> it with Perl for Win32?

No, it doesn't. Your web server needs to know how to execute it
though. It also needs to know that it's supposed to execute it.

Read the following:

Perl CGI FAQ and (no offense) Idiot's guide:

http://www.perl.com/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.com/CPAN/doc/FAQs/cgi/perl-cgi-faq.html

Section 9 of the perl FAQ:

# perldoc perlfaq9

Your web server documentation.

# perldoc perl

Ask how to set up your server on a group that talks about these
things, in comp.infosystems.www.* somewhere.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 30 Apr 1998 21:42:39 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Miten S Mehta <mehta@mama.indstate.edu>
Subject: Re: perl  -e filenamewith_regex datafiles question
Message-Id: <3549288F.8DF5AAAD@coos.dartmouth.edu>

[posted and mailed]

Miten S Mehta wrote:
> 
> I have put a bunch of regex in a file to operate on input file and this
> does not work.
> 
> perl -pi.bak -e regex_file.pl datafile
> 
> could you guide?

Refer to my earlier response to a similar post by you.  Do not use -e if your
program is in a file.

BTW, try this:

perl -w -e program.pl

to get an idea of what you were telling Perl to do.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 1 May 1998 00:09:05 GMT
From: lvirden@cas.org
Subject: Re: perl and Year 2000
Message-Id: <6ib3r1$1i8$1@srv38s4u.cas.org>


According to Shawn Abigail  <sabigail@newbridge.com>:
:I am using perl 5.004 as a tool on my workstation. My boss wants to know
:if it is Year 2000 compliant.  What do I tell her?  I haven't seen
:anything on the web about this.  Assuming that my operating system is
:compliant, are there any Y2K issues with perl?  Thanks!

What do you call perl?  the interpreter without any modules?  The interpreter
and just the modules that came in the .tar.gz ?  The interpreter, the
modules in the tar, and other modules from CPAN?  The interpreter,
modules from the tar, modules from CPAN, and modules written in house?

If you are just talking about the interpreter - and I _think_ also the
modules from the .tar.gz file that your perl came with, then the answer
given by a few of the other respondents is correct - the statement in
the faq covers you.

However, if you are calling perl the interpreter, modules from cpan (and
of course the libraries, etc. needed to build them), and stuff written
in house, then the answer is 'who knows'?  Folk have asked the question
about the CPAN module and script archives on this newsgroups off and on
for a while now and the answer appears to be 'no one's done a full
analysis'.  I have seen at least one perl module mentioned as supposedly
having a problem in Time::Local .
-- 
<URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,
<*> O- <URL:http://www.teraform.com/%7Elvirden/> only planning.
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: Fri, 01 May 1998 01:54:28 GMT
From: broomberg@nospam-ccgroupnet.com (Barry Roomberg)
Subject: Perl compiler - I've played with it, why so slow?
Message-Id: <354929cf.50595583@netnews.voicenet.com>

This program reads about a 100MB of
data, unpacks each record into about
100 fields, and run a loop displaying
the field with the field name in front
of it.

Seems to me the perfect text processing type of
app to test the compiler against.

Here's what happens:

$ time bad_dump.pl >/dev/null

real    2m6.86s
user    2m5.22s
sys     0m1.50s

$ time bad_dump >/dev/null

real    3m1.10s
user    2m56.17s
sys     0m1.47s

The compiled one is slower and MORE CPU consumptive!

Is this a bad test, or am I being silly here, expecting
it to get either faster or less CPU consumptive?
It fully eats an UltraSparc 300 the entire run time,
never bottlenecking on disk.

Is the compiler merely a wrapper around the interpreter?

What's the purpose, other than obscuring the source code?

Brown-nosing note to the Perl Gods:  I've been responsible 
for at least 20 copies of the PERL and Llama books being sold,
since I'm a PERL evangelist in a MF/COBOL soon to be Unix/Perl
shop.  Also, whenever I consult, I demand they buy multiple Camels
so there is always one wirthin reach when I visit, and then leave them
there to spread the word.


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

Date: 1 May 1998 00:10:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl loops have me stumped for pagenumbering sequence!!
Message-Id: <6ib3sp$6nb$1@comdyn.comdyn.com.au>

In article <3548FB78.49984A60@cia.com.au>,
	William Kolln <wkolln@cia.com.au> writes:
> Hi
> I posted this enquiry on 24/4 but perhaps my posting was too complex.
> Here is a 
> simplified version.
> 
> $count=5;
> @pagenumber=(1..$count); 
> @pagestart=(20 21 30 35 40 45 50 77 98 100);

Syntax error. You need commas.

> 
> 	$itembegin = (@pagestart[0]);

Do you mean 

	$itembegin = $pagestart[0];

> 1.	print "<a href=\"$itembegin\">$itembegin</a>\n";
> 	foreach $itemid(@pagestart[2,4,6,8,10]) {
> 2.	print "<a href=\"$itemid\"> $itemid\n";
> 	}
> 
> line 1. produces the number 20 for $itembegin.
> 
> line 2. produces the numbers 21 35 45 77 100 foreach $itemid

No, it doesn't. You refer to the 11th element (index 10) in
@pagestart, while it only has 10.

Next time, please insert the real code you tried. Also, run perl with
the -w flag?

> What I would like this to do, is replace the 2nd $itemid 
> in line 2. with the consecutive numbers 1..5
> but still be referenced in the anchor as $itemid.

Let's get rid of your code, and do it slightly differently.

#!/usr/local/bin/perl -w
use strict;

my $count=5;

my @pagestart=(20, 21, 30, 35, 40, 45, 50, 77, 98, 100);

# Supposing that you want the first one always, with index 0
# Note that the following removes the first element from @pagestart

print_page_link(0, shift @pagestart);

for my $i (1..$count)
{
	# Then you want the 1st, 3rd, etc..
    print_page_link($i, $pagestart[($i-1) * 2]);
}

sub print_page_link
{
    my $page_no = shift;
    my $page_start = shift;

    # You might want some error checking here

    print qq{<a href="$page_start">$page_no</a>\n};
}

OUTPUT:

<a href="20">0</a>
<a href="21">1</a>
<a href="35">2</a>
<a href="45">3</a>
<a href="77">4</a>
<a href="100">5</a>

> Is there any way this can be done? I have tried

That was just one way. I could come up with a few others, but I'll
leave that up to you.

> and have searched through CPAN and several books for
> different examples of looping and arrays, but after 2 weeks of trying
> I am at a loss about where to turn next.

# perldoc perlsyn
# perldoc perldata
# perldoc perlop
# perldoc perlfaq
# perldoc perlfunc
# perldoc -f shift

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 30 Apr 1998 19:23:47 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Perl loops have me stumped for pagenumbering sequence!!
Message-Id: <35490803.1E4B055C@negia.net>

William Kolln wrote:
> 
> @pagestart=(20 21 30 35 40 45 50 77 98 100);
> 
>         $itembegin = (@pagestart[0]);
> 1.      print "<a href=\"$itembegin\">$itembegin</a>\n";
>         foreach $itemid(@pagestart[2,4,6,8,10]) {
> 2.      print "<a href=\"$itemid\"> $itemid\n";
>         }
> 
> What I would like this to do, is replace the 2nd $itemid
> in line 2. with the consecutive numbers 1..5
> but still be referenced in the anchor as $itemid.
> 

why not use an iterator variable, oh let's call it $i, inside the
loop. each time through the loop add 1 to $i.

hope this helps,

-- 
Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com

 "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
                         - Cosmic AC


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

Date: Thu, 30 Apr 1998 17:43:12 -0700
From: Dale Phillips <dphi@ix.netcom.com>
To: Chris Wertman <chrisw@webchamps.com>
Subject: Re: Perl web server....
Message-Id: <35491AA0.3663@ix.netcom.com>

Chris Wertman wrote:
> 
> Some time ago I saw a webserver written in perl.. I have searched .
> engines.DejaNews etc and stilll cannot find it ,... any pointers as to
> where on the web it may live are appreciated...
> 
> Chris Wertman
If you look in Jon Orwant's Perl 5 - Interactive course
(isbn 1-57169-113-8) There are a few listed...
Plexus and a very small one called phttpd
ftp://ftp.earth.com/plexus
http://eewww.eng.ohio-state.edu/~pereirap/software/phttpd 

and of course Apache with embedded perl....

-- 
--dp----------------------------------------------
Dale Phillips        http://www.netcom.com/~dphi
dphillip@tabfs.com


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

Date: Fri, 01 May 1998 01:41:52 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: push @strArray, (24..31);
Message-Id: <354926AA.3AA50BF4@fccjmail.fccj.org>

Given -

my   @strArray = (21..39);
push @strArray = (90..121);
push @strArray = (299..310);


Is there a better way???

-Sneex-  :-)
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: 30 Apr 1998 23:39:59 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: SMTP and sockets
Message-Id: <6ib24f$6i5$1@comdyn.comdyn.com.au>

In article <354c2fde.3807016@news.tornado.be>,
	bart.mediamind@tornado.be (Bart Lateur) writes:

[You could have asked this in one of the comp.lang.mail groups]

> Question one: getservebyname('smtp','tcp') asks about the SMTP port. But
> the result does not depend on the $mailserver, which it should.
> Otherwise, it makes no sense, does it? If my computer uses the standard
> 25 for SMTP port, and the mailserver I'm trying to connect to uses
> another port number for SMTP, this code will use the wrong port number,
> right?

Depending on your machine's configuration. Assuming it is correct:
Your code will use the right port number. The other server is using
the wrong one. The assigned numbers for ports  (also known as well
known ports) are described in RFC1700, and should more or less be
adhered to. Of course, you're free to run any standard service on any
port you like, but I would call that wrong, not the other way around
:)

> Question two: if the DNS lookup doesn't work (gethostbyname() returns
> undef), I can STILL connect, but only to my local SMTP server. I'm not
> sure this is garanteed to work, but it works on my ISP's machine.

huh?

If $remote_ip is undef, I am not sure what the pack does to $remote_sock.
I'd say that it normally shouldn't work, but I might be wrong.

But, using undef, and ignoring the fact that the name cannot be looked
up is bad anyway. You should do some error handling there.

> So: why bother? Why do, for example, the Net::* modules do such an
> elaborate search to find out the proper SMTP server? I can send mail
> through virtually any SMTP server, and in particular, through the SMTP
> server on MY machine, right?

Maybe it uses localhost when $remote_ip is undef, but that will only
work on machines that do have an SMTP server. But more important is
that the code doesn't do what you want. If you want it to connect to
localhost, you should tell it to. If you want it to connect to
something else, tell it so. Don't rely on default behaviour like this,
munging undefs and stuff. You would do better by checking for undef,
and if it is, fall back on some default behaviour, for example, a
connection to localhost.

Added note: You will not be able to use virtually any SMTP server.
Most SMTP servers will only accept connections from 'known' hosts, by
configuration..  Typically any hosts belonging to the same network
owner.

Martien
-- 
Martien Verbruggen                      |
Webmaster www.tradingpost.com.au        | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Thu, 30 Apr 1998 20:51:16 -0500
From: Deva Seetharam <devs@usa.net>
Subject: Win32 Perl Compiler ?
Message-Id: <6ib9d6$h04@newsops.execpc.com>

Is there any perl compiler for windows ?

Deva



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

Date: Fri, 01 May 1998 00:57:00 GMT
From: drummj@mail.mmc.org (Jeffrey Drumm)
Subject: Re: Win32::NetResource::AddConnection exhibiting undocumented behaviour ?
Message-Id: <354a1ba5.265526169@news.mmc.org>

[posted and mailed]

On Wed, 29 Apr 1998 18:54:25 GMT, Gellyfish@btinternet.com (Jonathan Stowe)
wrote:

>I have a smallish script that for reasons of state runs on (sigh) an
>NT machine and connects in turn to series of Netware servers using
>Win32::NetResource::AddConnection.  
>
>This works fine when run from the command line, however when run under
>the schedule service it doesnt.  
>
>Thats fine, NT is crap and its nothing to do with Perl agreed.  

(snip)

>I am beginning to realize that some sins do have their own punishment.

Ah, a kindred spirit . . .

Whose requester/redirector are you using . . . M$ or Novell's? The
IntraNetware client for NT in combination with a buggy multiple UNC
provider driver (MUP.SYS) from M$ can cause unusually long delays in
establishing connections, possibly exacerbating a problem with
AddConnection caused by running your script in the background, under the
scheduler. Perhaps a timing problem?

The only other obvious thing I can think of is permissions; I would expect
NT's castrated cron to run _your_ job with _your_ privileges, but you never
know . . . also, are you logging out, or merely locking the workstation
(you know, the kind of locking where NT purportedly actually keeps
running)? ;-)

I'll try an AddConnection under the scheduler when I get into the office
tomorrow and see what kind of results I get, and let you know. Then I'll
scurry back to the safe haven of Unix, where Things Always Work Like
They're Supposed To.

-- 
                           Jeffrey R. Drumm, Systems Integration Specialist
                                  Maine Medical Center Information Services
                                     420 Cumberland Ave, Portland, ME 04101
                                                        drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented." -me


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

Date: Thu, 30 Apr 1998 21:16:46 -0400
From: "Todd McAnally" <tmcanally@tkmsoftware.com>
Subject: Re: Windows/NT, Perl, and redirection
Message-Id: <6ib81h$n0i$1@clarknet.clark.net>

I agree, print looks like what you want in this case.

You may be running into the problem where "x.pl > x.out" doesn't produce
output to x.out but "x.pl" produces output to the console.  You need to
explicitly run perl as in "perl x.pl > x.out" for redirection to work in NT
(at least with ActiveState).  I have a feeling there is something in the
registry to tell the system to attach a console when a command is implicitly
invoked so that redirection will work.  I don't know if or how it can be
done.

Todd

Igor Krivokon wrote in message <6i7vfa$o2r$1@news.ncal.verio.com>...
>Michael Genovese wrote in message <35473240.18D@slpma8.ed.ray.com>...
>>A co-worker learning perl has it installed on his Windows/NT box.
>>
>>The other day,  when I was helping him with a simple perl problem,
>>we noticed that redirection doesn't work quite the same as in UNIX.
>>
>>For instance, the following
>>######################
>>foreach $A (@ARGV) {
>>    printf("$A\n");
>>}
>>######################
>>
>>WILL redirect under UNIX (foo arg1 arg2 arg3 ... > www);
>>but NOT under Windows/NT.  Can anyone tell me why, or suggest
>>a fix ?
>>
>
>
>1) it DOES work under NT
>2) be careful - print and printf are two different functions
>
>Regards,
>
>Igor Krivokon
><igor.k@usa.net>
>
>




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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 2469
**************************************

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