[9841] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3434 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 13 00:08:05 1998

Date: Wed, 12 Aug 98 21:00:20 -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           Wed, 12 Aug 1998     Volume: 8 Number: 3434

Today's topics:
    Re: A Regexp problem (Andre L.)
        bug in rand()? (Alex Dong Li)
    Re: Calculate Date in Perl <gwynne@utkux.utk.edu>
    Re: checking if files exist (Sitaram Chamarty)
    Re: chown -h (Sweth Chandramouli)
    Re: dates in excess of 2037 (A Problem???) (Greg Andrews)
    Re: formmail.cgi... any cgi <briant@packeteer.com>
    Re: HELP !!! Programmer without documentation !!! (Ronald J Kimball)
    Re: how to <rootbeer@teleport.com>
    Re: how to <ajohnson@gpu.srv.ualberta.ca>
    Re: I =?iso-8859-1?Q?can=B4t?= run any perl prog. on my (Charles DeRykus)
    Re: I =?iso-8859-1?Q?can=B4t?= run any perl prog. on my (Charles DeRykus)
    Re: IMPORTANT: Proper Netiquette <rick.delaney@shaw.wave.ca>
    Re: lexically scoped aliases (Charles DeRykus)
    Re: Match '$a' in regexp--can't do it (Mark-Jason Dominus)
    Re: Named Pipes on NT (mikep)
        Northern Colorado Perl Users Group <gnat@frii.com>
    Re: Perl script interaction with external application <rootbeer@teleport.com>
    Re: Q: How to read a file piece by piece (Mark-Jason Dominus)
    Re: Q: Problems with <system> command (Ronald J Kimball)
    Re: search text in specific columns (Charles DeRykus)
    Re: Self-printing code (Charles DeRykus)
        test posting -- please ignore <stevenba@ccpl.carr.lib.md.us>
        The Four P's: Perl, Paging, and Palm Pilots...... mail83870@pop.net
    Re: What's the difference? <rick.delaney@shaw.wave.ca>
    Re: X-file (?=...), case postponed. (Ronald J Kimball)
    Re: X-file (?=...), case postponed. (Abigail)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 12 Aug 1998 23:22:39 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: A Regexp problem
Message-Id: <alecler-1208982322390001@dialup-800.hip.cam.org>

In article <6qtb9k$1nv$1@client3.news.psi.net>, abigail@fnx.com wrote:

[snip]

> BTW, 'regex' is much easier to pronounce than 'regexp'.


Tell that to the guy who wrote the documentation.

A.L.


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

Date: Thu, 13 Aug 1998 03:44:36 GMT
From: lidong@globalserve.net (Alex Dong Li)
Subject: bug in rand()?
Message-Id: <6qtngo$pen$1@whisper.globalserve.net>

Is there is bug in random number generation function rand()?
For the following code, which is expected to generate random numbers between 0 
and 8, different OS gave the different results:
On unix, it seems to be fine.
On Win95, it generates a "second" number, a number which is closely related to 
the system time in seconds.
On WinNT, it gerneates a real constant.

#!/usr/local/bin/perl -w
$ran= int(rand(9));
print $ran;
    

Has anyone noticed such a problem?


Alex


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

Date: Wed, 12 Aug 1998 22:13:36 -0500
From: "Robert Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: Calculate Date in Perl
Message-Id: <6qtlhf$6hs$1@gaia.ns.utk.edu>

Use CGI.pm and POSIX this way:

#!/path/to/perl/or/whatever  -w

use CGI qw(:standard);
use POSIX 'strftime';
print("Content-type: text/html\n\n");
print("<html>\n");
print("<head>\n");
print("<title>This is a test</title>\n");
print("</head>\n");
print("<body>\n");

$format =3D '%d %B %Y';
$current_time =3D strftime($format,localtime);
print "The day is ", $current_time, ".";

Bob Gwynne
__________________________________
Robert Gwynne, Ph.D
Speech Communication
University of Tennessee, Knoxville
gwynne@utkux.utk.edu

----------
In article <6qogse$pl3$1@nnrp1.dejanews.com>, ngong@my-dejanews.com wrote:


=B7use Date::Calc qw(:all);
=B7use CGI;
=B7print("Content-type: text/html\n\n");
=B7print("<html>\n");
=B7print("<head>\n");
=B7print("<title>This is a test</title>\n");
=B7print("</head>\n");
=B7print("<body>\n");
=B7
=B7($year, $month, $day) =3D Today();
=B7print("Today is $day/$month/$year");
=B7
=B7print("</body>\n</html>");



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

Date: 13 Aug 1998 03:21:25 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: checking if files exist
Message-Id: <slrn6t3d6s.j1g.sitaram@diac.com>

On 12 Aug 1998 01:51:00 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, syarbrou@ais.net (Steve .) writes:
>:How do I go about checking if files exist in a directory?  Thanks.
>
>Assuming that you bothered to install a reasonable operating system and
>traditional filesystem, the following is efficient and effective:
>
>    $is_empty = (stat($dir))[3] == 2;

That'll only tell you if the dir has no subdirs, nothing to do
with files existing in it...

>If one of my premises is false, you're on your own.
>
>--tom
>-- 
>Unix is defined by whatever is running on Dennis Ritchie's machine.


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

Date: Thu, 13 Aug 1998 03:35:04 GMT
From: sweth-usenet@astaroth.nit.gwu.edu (Sweth Chandramouli)
Subject: Re: chown -h
Message-Id: <sweth-usenet-1208982335450001@alex-va-n013c081.moon.jic.com>

In article <6qrdqs$50h$1@monet.op.net>, mjd@op.net (Mark-Jason Dominus) wrote:

>In article <sweth-usenet-1208980001310001@alex-va-n013c081.moon.jic.com>,
>Sweth Chandramouli <sweth-usenet@astaroth.nit.gwu.edu> wrote:
>>foreach file (@filelist) {
>>   (@stats = stat $file) && (@lstats = lstat $file);
>>   if (($stats[0] != $lstats[0]) or ($stats[1] != $lstats[1])) {
>
>It seems to me that
>
>    if (! -l $file) { 
>
>
>would be much simpler here.

   doh!  i actually had the camel book open to the page on file test
operators while typing the above, but still somehow missed the -l
operator.
   i've tried working this into my script, but it doesn't seem to be doing
what i want.  here's the important chunk:

sub uid_find_action {
   if (! -l $File::Find::name) {
      ((@uid_tmp_array = lstat($_)) && ($uid = $uid_tmp_array[4])) &&
      ($uid == $from_uid) &&
      (chown $to_uid, $uid_tmp_array[5], $File::Find::name);
   } else {
      system ("chown","-h","$to_uid","$File::Find::name");
   };
};

   this is the find_action subroutine for a find (from the File::find
module) that iterates across a hash of uids to map from/to.  the script
worked fine before, when the action was just the first portion of the if
loop, and for those files that aren't symlinks (and thus still use that
portion), things still work.   for the symlinks, however, the $to_uid var
that is being used for all of the system calls is the last one of the
hash, as opposed to the appropriate one for that particular iteration.  is
there any reason that $to_uid would change depending on which part of the
if logic above were matched?
   (if the problem doesn't look like it is in this particular chunk, and
you'd like to do me a huge favor, the entire script is at
<http://astaroth.nit.gwu.edu/~sweth/geek/mvid.pl>.  this was the only part
that was changed, though (i think), between working and not working.)

   -- sweth.

-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


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

Date: 12 Aug 1998 18:27:06 -0700
From: gerg@shell1.ncal.verio.com (Greg Andrews)
Subject: Re: dates in excess of 2037 (A Problem???)
Message-Id: <6qtfda$fg2$1@shell1.ncal.verio.com>

cberry@cinenet.net (Craig Berry) writes:
>                                     Specifically, the type time_t is
>a 32-bit signed integer count of seconds since January 1 1970.  (Why they
>made it signed is beyond me; were it unsigned, we'd have a Y2126 problem
>instead.)
>

Perhaps because the creators of Unix imagined it might be used
to work with dates prior to the Unix epoch, which would need to
be expressed in negative values of time_t?

  -Greg


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

Date: Wed, 12 Aug 1998 18:58:46 -0700
From: Brian Tiemann <briant@packeteer.com>
Subject: Re: formmail.cgi... any cgi
Message-Id: <35D24856.D3376F46@packeteer.com>

Marjorie MacDonald wrote:
 
> The service we use to host our web site has set me up a CGI directory.
> First of all, it is NOT under my normal HTML directory, it's at a
> completely different URL. Is this normal? Does this cause problems?

	It's pretty normal. That's what ScriptAlias does (assuming you're
dealing with Apache here); it specifies a certain directory in which
everything should be executed as a script, regardless of file extension,
and not browseable by curious clients.

> Secondly, everything (and I do mean EVERYTHING) I try to call from an HTML
> document gives me a 403 Forbidden error. Doesn't matter what it is or where
> it's from (last one I tried was the FormMail script from Matt's Script
> Archive). I finally did get the path to the Perl interpreter from them, so
> I can set that correctly now. I just want to get any error other than the
> 403 Forbidden one, so that I know the script is being accessed.

	It's likely a permissions problem, but not something for them to deal
with... if you upload a script, you need to set it executable. This
needs to be done on each script you want to run (though not on any other
files). Telnet to the server, cd to your CGI directory, and "chmod +x
filename".

Brian


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

Date: Wed, 12 Aug 1998 22:51:20 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: HELP !!! Programmer without documentation !!!
Message-Id: <1ddo6pi.2pbumk3bnpxcN@bay2-150.quincy.ziplink.net>

Laurent MARTIN <laurent@gide.isdnet.net> wrote:

> [blah blah blah]

See subject.

-- 
 _ / '  _      /         - 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, 13 Aug 1998 01:20:22 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: how to
Message-Id: <Pine.GSO.4.02.9808121818470.10161-100000@user2.teleport.com>

On Wed, 12 Aug 1998, Nicholas Ritter wrote:

> Subject: how to

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 have an array element that contians a 12 digit, alphanumeric,
> case-insentive string (to be more specific, it is an ethernet address,
> but without the colons).
> 
> I am new to perl, and I can't seem to figure out a way to get perl to
> take the array element, and insert a colon every two characters.

Try a substitution. Check under s/// in your favorite book or manpage.

> Also, how can I take an array element and flip it arround. For
> instance:
> 
> someArray[1] = 2.1
> 
> And convert it to:
> 
> someArray[1] = 1.2

I think you want $someArray[1] there. But you can do that with a
substitution as well. Have fun with it?

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



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

Date: Wed, 12 Aug 1998 22:32:38 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: how to
Message-Id: <35D25E56.4F27DC7A@gpu.srv.ualberta.ca>

Tom Phoenix wrote:
> 
> On Wed, 12 Aug 1998, Nicholas Ritter wrote:
> 
[snip]
 
> > Also, how can I take an array element and flip it arround. For
> > instance:
> >
> > someArray[1] = 2.1
> >
> > And convert it to:
> >
> > someArray[1] = 1.2
> 
> I think you want $someArray[1] there. But you can do that with a
> substitution as well. Have fun with it?

perhaps 'perldoc -f reverse' might be of some
help here as well.

regards
andrew


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

Date: Thu, 13 Aug 1998 00:40:29 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: I =?iso-8859-1?Q?can=B4t?= run any perl prog. on my server
Message-Id: <ExLr7H.KDA@news.boeing.com>

In article <6qsism$pcv$1@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Veronica Machado (vmachado@nt.com) wrote on MDCCCVII September MCMXCIII
>in <URL: news:35D18916.C7607C96@nt.com>:
>++ My server doesn4t accept any perl program .
>++ Does anyone know why ??
>
>

programming in the dark happens all the time :)

--
Charles DeRykus


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

Date: Thu, 13 Aug 1998 00:59:25 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: I =?iso-8859-1?Q?can=B4t?= run any perl prog. on my server
Message-Id: <ExLs31.M16@news.boeing.com>

In article <6qsism$pcv$1@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>Veronica Machado (vmachado@nt.com) wrote on MDCCCVII September MCMXCIII
>in <URL: news:35D18916.C7607C96@nt.com>:
>++ My server doesn4t accept any perl program .
>++ Does anyone know why ??
>
>
>Are you sure the light in the server room is on?

programming in the dark happens all the time :)

--
Charles DeRykus




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

Date: Thu, 13 Aug 1998 01:45:10 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: IMPORTANT: Proper Netiquette
Message-Id: <35D24695.49665C3E@shaw.wave.ca>

BG {BG}


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

Date: Thu, 13 Aug 1998 01:51:31 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: lexically scoped aliases
Message-Id: <ExLuHv.3BJ@news.boeing.com>

In article <6qs91m$8hi$1@hades.rz.uni-sb.de>,
Niklas Matthies  <matthies@fsinfo.cs.uni-sb.de> wrote:
 > Hi,
 > 
 > Is it somehow possible to create lexically scoped aliases, i.e. what
 > one might expect that 
 > 
 >   my *foo = \$bar;
 > 
 > would do if it were legal?
 > 
 > E.g. I want to manipulate parameters passed to a subroutine directly
 > (without copying them or using references to them), but want to use
 > more descriptive names than @_ or $_[5]. Using 'local' would pollute
 > the symbol table, which I don't want to.
 > 

How 'bout something hideous with -P  then ... 


#!/usr/bin/perl -wP
use strict;
#define ARG $_
sub my_sub { ARG[0] = ...  }
  

--
Charles DeRykus


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

Date: 12 Aug 1998 23:37:49 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Match '$a' in regexp--can't do it
Message-Id: <6qtn2d$bd8$1@monet.op.net>

In article <ExLMpz.EvC@unx.sas.com>, Chris Sherman <sherman@unx.sas.com> wrote:
>I can't find a way to match the pattern '$a' (in a regular
>expression and replace it with something else.  

Craig already explained why the stuff you tried didn't work, but I
didn't notice that he told you what to do instead:

	$line = '$a';
	$pat = quotemeta '$a';   
	$line =~ s/$pat/b/;
	print "pre quotemeta: $line\n";

See, what you need is to construct the pattern 
	\$a

and interpolate it into the regex.  `quotemeta' constructs the pattern
you want, and then it's easy to put it into the regex.

This is the general solution when you have some string X and you want
to match lines that contain X.  it's completely analogous to

	chomp($pat = <STDIN>);
	$pat = quotemeta $pat;
	while (<STDIN>) { print if /$pat/ }



Stop reading now.
--------------------------------


No, really.

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

The only reason I'm going to mention 

	
	$line =~ s/${\ quotemeta '$a'}/b/;    # LOD

is to keep someone else from suggesting it.

Please don't use this.


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

Date: 13 Aug 1998 02:09:50 GMT
From: mikep@rt66.com (mikep)
Subject: Re: Named Pipes on NT
Message-Id: <6qthte$146$2@news.rt66.com>

In article <01bdc4ba$f3e5b280$8cb3ba9b@tlabs-raj>
"R. Player" <player@avoidspam.com> writes:

> Does anyone know how to create a named pipe in perl on NT....are named
> pipes even supported
> on NT-Perl.

Named pipes are supported under NT yes. Though I'm uncertain of how
to create them under perl. If support is there for perl, I imagine that
little would have changed cross platform in terms of how you would go
about doing so.

===========================
Mike Powell
mikep@rt66.com
http://www.rt66.com/~mikep/


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

Date: 12 Aug 1998 11:31:54 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Northern Colorado Perl Users Group
Message-Id: <5qsoj2hzsl.fsf@prometheus.frii.com>

If you're in Longmont, Loveland, Fort Collins, or maybe even Denver or
Boulder, and you want to get together in a sympathetic atmosphere to
talk Perl with other like-minded addicts, then this message is for
you.

Let's meet at 6pm on Wednesday August 26 (the week after the Perl
Conference) at the Sportscaster's Bar and Grill.  It's at 165 E
Boardwalk, just off College Avenue (US 287) in south Fort Collins.
It's the same place the Northern Colorado Linux Users Group meets,
and is a pleasant smokefree bar (with NTN trivia!).

Let's get together for a beer and swap war stories.  I'll even give
you a report on the Perl Conference if you couldn't make it (complete
with photos!).

Share and enjoy,

Nat


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

Date: Thu, 13 Aug 1998 01:17:54 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl script interaction with external application
Message-Id: <Pine.GSO.4.02.9808121813000.10161-100000@user2.teleport.com>

On Wed, 12 Aug 1998, Marco Goncalves wrote:

> Is it possible for a Perl script to interact directly (not using
> something like a telnet/socket) with an external application (like a
> Cobol program running on a Dos/Netware environment)? 

How are you going to connect to an "external" application without using
"something like a telnet/socket"? (I put those terms in quotes because I
don't know what you mean by them. Isn't any other application "external"
to the one which is currently running?)

> The Perl script would call the app and interact with it like a user
> would do it.

Sounds like what the FAQ talks about under "How can I write expect in
Perl?" But that would use "something like a telnet/socket", at least as I
use those terms.

Hope this helps!

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



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

Date: 12 Aug 1998 22:36:26 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Q: How to read a file piece by piece
Message-Id: <6qtjfa$b0h$1@monet.op.net>


In article <6qtc1u$1nv$2@client3.news.psi.net>,
Abigail <abigail@fnx.com> wrote:
>sub Send_As_tgz {
>   print "Content-Type: application/zip\n";
>   print "Content-Disposition: attachment;  filename=\"$file_name.tgz\"\n\n";
>   system $TAR, '-C', $Rwhere, 'czf', '-', $who;
>}

Because of standard I/O buffering, you have probably written the tar
data before the HTTP header here.  You really need to have


>sub Send_As_tgz {
    my $old_bar = $|;
    $| = 1;
>   print "Content-Type: application/zip\n";
>   print "Content-Disposition: attachment;  filename=\"$file_name.tgz\"\n\n";
>   system $TAR, '-C', $Rwhere, 'czf', '-', $who;
    $|=$old_bar;
>}



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

Date: Wed, 12 Aug 1998 22:51:22 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Q: Problems with <system> command
Message-Id: <1ddo73f.ya94uic9d0i8N@bay2-150.quincy.ziplink.net>

Gary L. Burnore <gburnore@databasix.com> wrote:

> On 12 Aug 1998 18:33:54 GMT, in article <6qsn6i$pnk$3@client3.news.psi.net>,
> abigail@fnx.com (Abigail) wrote:
> 
> >Any reason why you can't find what you want in the manual?
> >
> Any reason why you still act like a jerk when you post?

Funny, I was about to ask you the same thing...

-- 
 _ / '  _      /         - 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, 13 Aug 1998 02:22:11 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: search text in specific columns
Message-Id: <ExLvwz.5sL@news.boeing.com>

In article <6qqele$e2u$1@nnrp1.dejanews.com>,  <stevenba@carr.org> wrote:
>Hi.  I'm very new to Perl, so please excuse me if this is not the correct
>forum or the answer is obvious.
>
>Can anyone tell me if (and if so, how & where) to search a text file in
>specific columns? or search beginning in column X? Are there any existing
>tools to do this? Are there any such 'window'-like facilities?	(like samples
>I saw in 'widgets') after I installed Perl?
>

Sometimes you can use the autospit command line option:

perl -ane 'print $F[1]'  file    # prints 2nd column 

or, even split on something other than whitespace:

perl -F';' -ane 'print $F[1]'  file    # split on semicolon


HTH,
--
Charles DeRykus


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

Date: Thu, 13 Aug 1998 02:03:26 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Self-printing code
Message-Id: <ExLv1q.3KJ@news.boeing.com>

In article <6qqej7$dp5$1@nnrp1.dejanews.com>,
Patrick Timmins <ptimmins@netserv.unmc.edu> wrote:
>In article <6qn9un$d0t$1@nnrp1.dejanews.com>,
>  Robin Houston <robin.houston@guardian.co.uk> wrote:
>> Last week there was a thread about perl programs which print their
>> own source (without reading it in). Someone perceptively pointed
>> out that the shortest such program was the null script - a
>> zero-length file.
>>
>> Aside from this trivial case, what's the shortest such program?
>[snip]
>
>Although cheating and not portable to boot, on Gurusamy Sarathy
>Perl 5.004_02 for Win32, a file named 'print$0' with the one liner:
>
>print$0
>
>works. Note the lack of a semicolon on the end. Doesn't even throw a
>warning with -w ! (why not?)
>

The final semicolon in a block is optional and there's an 
implicit end block after the last statement. 

HTH,
--
Charles DeRykus


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

Date: Wed, 12 Aug 1998 23:09:28 -0300
From: Steven Barbash <stevenba@ccpl.carr.lib.md.us>
Subject: test posting -- please ignore
Message-Id: <35D24AD8.5C5D@ccpl.carr.lib.md.us>

test posting -- please ignore


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

Date: Thu, 13 Aug 1998 02:23:07 GMT
From: mail83870@pop.net
Subject: The Four P's: Perl, Paging, and Palm Pilots......
Message-Id: <6qtimb$e4t$1@nnrp1.dejanews.com>



Have any of you had ( or heard of ) experiences with
using Perl/Perl modules to troll for OS ( and/or Oracle database )
errors, and automatically dial out via modem to a
pager?  I would be interested in pointers to information
resources. Final goal is to dial out alerts to a PDA, and
via two-way paging ( e.g. SkyLink or similar ) remediate
remotely. ( Someone must have done parts of this, and
I am not eager to dive into arcana like IXO/TAP
without asking first....)

TIA


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Thu, 13 Aug 1998 01:56:39 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: What's the difference?
Message-Id: <35D2493F.C7EFDD43@shaw.wave.ca>

Ronald J Kimball wrote:
> 
> s ack! this can't be right. something is amiss;
> m this is fun too;
> 
> For even more fun, try using one of the letters that has special 
> meaning when backslashed, such as s or w.
> 

ObFuscated:

$_ = 'wow, this _is_ fun!';

s w\wwmwg;
s s\ss'sg;

$pat = '\w';
s w$patwmwg;

$s = '\s';
s s${\s}s;sg;

Is there a way of getting \w or \s in such a pattern without putting the
pattern in a variable?  I think probably not, since the pattern
separators are looked for by the compiler first?

Just curious.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Wed, 12 Aug 1998 22:51:16 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <1ddo5ve.bugjws54wh1oN@bay2-150.quincy.ziplink.net>

Patrick Timmins <ptimmins@netserv.unmc.edu> wrote:

[discussion of split(/(?=(.*)/)]

> My arguement is consistent with the above fine documentation. The
> argument is over *when* does a parenthetical substring in a split
> throw its' matching substring into the array? As specified in the
> fine documentation a few lines down from your citing of the fine
> documentation:
> 
> If the PATTERN contains parentheses, additional array elements are
> created from each matching substring in the delimiter.

The delimiters are put in the array between the elements they delimit,
of course.

> So I'm just arguing that this should follow common sense and
> mathematical form. Since '(.*)' is enclosed in '(?=..)' and then in
> the '/../' of split, it should be evaluated first [ the way '(1+3)'
> is evaluated first in 'sqrt(4*(1+3))' ]. Just because you know
> sqrt(0*(1+3)) is going to equal zero before you ever get to evaluating
> the '(1+3)', doesn't mean that you should skip over evaluating the
> '(1+3)', mathematically.

If split used mathematical expressions instead of regular expressions,
this might have some relevance.

Regular expressions are not evaluated from the inside out, they are
evaluated from left to right.  If you insist on viewing the first
argument to split as a mathematical expression, you're never going to
get it.

Otherwise I guess that /(ab(cd)ef)/ put 'cd' in $1 and 'abcdef' in $2...

> Logically, I would expect Perl to do this with split, and the first
> element of the array should be the delimiter specified by '(.*)',
> which would be the whole EXPR, if '(.*)' were, logically, the first thing
> being evaluated.

Suppose the string being split is 'a|b|c'.  So, you want to put the
delimiter *before* the first element??  split(/(\|)/, 'a|b|c') would
return ('|', 'a', '|', 'b', 'c') or something like that.  That's hardly
logical...

Logically, the first element of the array should be the first element of
the delimited string.  And that's how split works.

> Since Perl doesn't do this logical sort of thing (and maybe for good
> reason, as pointed out by Dave Lorand), it confused me. Since this
> little bit of straying from logic isn't mentioned in the fine
> documentation, it makes seeing sigs in the ilk of
> 
> @arr =  split /(?=(.*))/s , "Just another Perl Hacker\n";
> for (@arr) { print "$_"; }
> 
> doubly confusing, as I'm sure you'll agree! :)

No, I would not agree.  Perl is being quite logical.

for (1..100) {
  print "mathematical expressions != regular expressions\n";
}

-- 
 _ / '  _      /         - 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: 13 Aug 1998 02:36:30 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qtjfe$3hd$1@client3.news.psi.net>

Patrick Timmins (ptimmins@netserv.unmc.edu) wrote on MDCCCVII September
MCMXCIII in <URL: news:6qsvvp$jtl$1@nnrp1.dejanews.com>:
++ In article <6qsd9v$oda$1@client3.news.psi.net>,
++   abigail@fnx.com wrote:
++ >
++ >    A pattern matching the null string (not to be confused with
++ >    a null pattern C<//>, which is just one member of the set of patterns
++ >    matching a null string) will split the value of EXPR into separate
++ >    characters at each point it matches that way.
++ 
++ My arguement is consistent with the above fine documentation. The
++ argument is over *when* does a parenthetical substring in a split
++ throw its' matching substring into the array? As specified in the
++ fine documentation a few lines down from your citing of the fine
++ documentation:
++ 
++ If the PATTERN contains parentheses, additional array elements are
++ created from each matching substring in the delimiter.

Indeed. Delimiters are *between* characters, as the manual explains.
/(?=(.*))/ is applied *between* characters. No confusion. Nothing missing
or misleading in the documentation.

++ So I'm just arguing that this should follow common sense and
++ mathematical form. Since '(.*)' is enclosed in '(?=..)' and then in
++ the '/../' of split, it should be evaluated first [ the way '(1+3)'
++ is evaluated first in 'sqrt(4*(1+3))' ]. Just because you know
++ sqrt(0*(1+3)) is going to equal zero before you ever get to evaluating
++ the '(1+3)', doesn't mean that you should skip over evaluating the
++ '(1+3)', mathematically.

Huh? What precedence rules are you using to conclude the (.*) has to
be done first? /(?=(.*))/ matches the null string. So.... split matches
the string into separate characters, at each point it matches that way.
First point to match would be after the 'J'. Which is followed by
'ust another Perl hacker'.

++ Logically, I would expect Perl to do this with split, and the first
++ element of the array should be the delimiter specified by '(.*)',
++ which would be the whole EXPR, if '(.*)' were, logically, the first thing
++ being evaluated.

No, I don't find it at all logical to have precedence rules of a regex
based on sqrt().

++ Since Perl doesn't do this logical sort of thing (and maybe for good
++ reason, as pointed out by Dave Lorand), it confused me. Since this
++ little bit of straying from logic isn't mentioned in the fine
++ documentation, it makes seeing sigs in the ilk of

The fine documentation mentions "splitting into seperate characters
at each point it matches that way". Even if Ilya finds this misleading,
it's still enough to explain what's happening.

Your problem is that you think Perl acts differently, get confused when
it does, and then complain your method isn't explained in the manual.



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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