[11310] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4910 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 16 19:16:29 1999

Date: Tue, 16 Feb 99 16:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 16 Feb 1999     Volume: 8 Number: 4910

Today's topics:
    Re: /i in regexp kills performance. (Ilya Zakharevich)
    Re: /i in regexp kills performance. <uri@ibnets.com>
    Re: Announce: Perl Function Repository (was Re: Calcula pshank@systems.dhl.com
    Re: Byte Code Compiler <ludlow@us.ibm.com>
    Re: choosing start_element() vs. startElement() (Earl Hood)
    Re: E-mail CGI script <vrwaciuk@sprint.ca>
    Re: email to data base script <roger@newlabour.demon.co.uk>
        How to get Telnet 'header' Information from a Perl <news@redland.azariah.org.uk>
    Re: How to get Telnet 'header' Information from a Perl <andy@focus-consulting.co.uk>
    Re: how to sort by file date with year (Tad McClellan)
        LWP and B Module dwarren@thebigwave.net
    Re: none (Abigail)
        Opening en printing text files with variables <arno_22@hotmail.com>
        Perl evangelism aixgod@ix.netcom.com
    Re: Perl evangelism <camerond@mail.uca.edu>
        Perl script for processing JCLs vasanthraghavan@hotmail.com
    Re: Problem with UPLOAD files by perl !?? (Mark Nutini)
    Re: Python vs. Perl vs. tcl ? (Keith Phillips)
    Re: Regex Expansion and Metrics (Tad McClellan)
    Re: removing blank lines in a multiline string? <jglascoe@giss.nasa.gov>
    Re: removing blank lines in a multiline string? <uri@ibnets.com>
    Re: Variable interpolation w/regex <jglascoe@giss.nasa.gov>
        y2k problems with perl <Abhilash.Ravindran@compaq.com>
    Re: y2k problems with perl <allan@due.net>
    Re: y2k problems with perl <upsetter@ziplink.net>
    Re: y2k problems with perl (Alastair)
    Re: y2k problems with perl (I R A Aggie)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 16 Feb 1999 22:14:14 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: /i in regexp kills performance.
Message-Id: <7acqjm$lcf$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Uri Guttman 
<uri@ibnets.com>],
who wrote in article <39vhh2uk7q.fsf@ibnets.com>:
>   IZ> There are 6 *released* versions of 5.005_5*.  And the released
>   IZ> versions of 5.0050* are much closer to being destructive than
>   IZ> 5.005_5[34].
> 
> those are still maintenence versions. not stable released versions. so
> my point is valid. anything with a _5* is NOT for mass consumption.

So is not 5.005_02.

>   IZ> Why are you putting words in my mouth?  I never complained about
>   IZ> Hip Owl.  (It is a very good book if you want to discuss 5.002.)
>   IZ> All I did was I commented on this book.
> 
>   >> and as a final note, there are many 5.004_04's out there which have
>   >> few of your new features so MRE is still fairly accurate for that.
> 
>   IZ> Hip Owl documents 5.002.  5.004_04 is *ways* ahead of Hip Owl.
> 
> as compared perl 5 vs. perl4? you seem to forget that most (and i mean
> MOST) perl programs and programmers never use most of the newer features
> in regexes that you so love.

Why are you putting words in my mouth again?  Did I say anything about
new features?  5.004_04 is *ways* ahead of Hip Owl without any new
feature added.

> and ilya, please stop cc'ing me. it isn't stealth but you know i read
> the groups and i always read followups to my posts.

My trn setup honors mail-copies-to: never header.  Use it.

Ilya


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

Date: 16 Feb 1999 17:23:23 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: /i in regexp kills performance.
Message-Id: <39u2wmugx0.fsf@ibnets.com>

>>>>> "IZ" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:

  IZ> So is not 5.005_02.

so you say. others use it in production. no one uses (or should use)
5.003_* in production.

  IZ> Hip Owl documents 5.002.  5.004_04 is *ways* ahead of Hip Owl.
  >>  as compared perl 5 vs. perl4? you seem to forget that most (and i
  >> mean MOST) perl programs and programmers never use most of the
  >> newer features in regexes that you so love.

  IZ> Why are you putting words in my mouth again?  Did I say anything
  IZ> about new features?  5.004_04 is *ways* ahead of Hip Owl without
  IZ> any new feature added.

that makes no sense. how is it ahead without features? if it is more
efficient, that is a feature. we are talking regexes here, not the whole
language. so again i ask you, list the new features of regex in 5.004_04
not in 5.002. how many of them are used by anyone, let alone newbies.

  IZ> My trn setup honors mail-copies-to: never header.  Use it.

i don't want to disable other from doing so. occaisionally it is
warranted. you always do it, i am asking you not to.

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Tue, 16 Feb 1999 20:57:31 GMT
From: pshank@systems.dhl.com
Subject: Re: Announce: Perl Function Repository (was Re: Calculate yesterdays date)
Message-Id: <7acm3m$d5g$1@nnrp1.dejanews.com>

In article <m3d83g92nf.fsf_-_@moiraine.dimensional.com>,
  Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:

> Daniel Grisinger          dgris@moiraine.dimensional.com
> perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
> m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'

The PFR is exactly what I need most at my early stage of Perlearning. Many
thanks to dgris et al. Now that you've done me a favor, I'll bother you. 
When I execute your sig I get a compile-time error because perl can't find
the re.pm module.  Am I missing something about how arguments to command-line
switches are parsed?

Wassup?
--
Peter Shank                         700 Airport Blvd #300
Product Manager                      Burlingame, CA 94010
DHL Systems, Inc                          +1-650-425-5146
pshank@systems.dhl.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 16 Feb 1999 16:47:34 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Byte Code Compiler
Message-Id: <36C9F586.384D4D7F@us.ibm.com>

R.J. Russell wrote:
 
> I've heard rumors that it's possible to "compile" a perl text source
> script to byte code. How does one do this / where is the documentation?
> All I can seem to find is a one-liner in perlsec.
> 
> All I'm trying to do is hide the source code from the prying eyes of
> non-programmers, not any real attempt at serious security. Any other
> suggestions of methods to do this are also appreciated.

If you do a dejanews search, you'll find that this gets asked a lot.

Just out of curiosity, what would a non-programmer do with Perl source
code that worries you so much?  Wouldn't you rather keep it out of the
hands of programmers if obscurity is your goal?

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: 16 Feb 1999 23:01:26 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: choosing start_element() vs. startElement()
Message-Id: <7actc6$13l@news.service.uci.edu>

In article <m3pv7g46pz.fsf@biff.bitsko.slc.ut.us>,
Ken MacLeod  <ken@bitsko.slc.ut.us> wrote:

>The background is that the majority of XML toolkit standards have
>started using Java as their reference language for creating APIs.
>Java's style for method names is mixed-case with initial lower case,
>like `startElement()'.

>Perl's recommended style, as I'm sure you know, is to use all lower
>case seperated with underscores, like `start_element()'.

>As we author Perl modules that implement these broader standards it
>becomes an issue of whether to use the style given in the reference
>implementation (Java usually) or localize it to Perl style.

If there is a reference/standard implementation, it is nice to follow
the same naming conventions.  It makes it easier for developers to
move between different programming languages.

Note, it should be easy to provide both.  I.e.  Provide both the
mixed-case interface like other language libraries and the Perlish
interface.  I have noticed that some authors of modules that interface
with a reference/standard library have done this.

	--ewh
-- 
             Earl Hood              | University of California: Irvine
      ehood@medusa.acs.uci.edu      |      Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME


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

Date: Tue, 16 Feb 1999 17:14:47 -0500
From: "Vince Waciuk" <vrwaciuk@sprint.ca>
Subject: Re: E-mail CGI script
Message-Id: <N8my2.37023$b8.16080003@hme2.newscontent-01.sprint.ca>

Hi Chris

I just had this same problem.
Try using the SendMail.pm

It is really simple to use. Just make sure to specify your smtp server
correctly.

You can find SendMail at www.tneoh.zoneit.com

Good Luck
Vince

webmaster@kesselsupholstering.com
www.kesselsupholstering.com

Chris Boot wrote in message <7acmfg$9gv$1@news4.isdnet.net>...
>Hi,
>    I NEED and easy to use emailer CGI script that is platform independent
>(I.E. uses sockets instead of sendmail).
>
>Please reply to email address below.
>
>--
>Chris Boot
>Vice President of
>The Macintosh Discovery Club
>mactech.tmdc@worldnet.fr
>http://www.tmdc.org/
>http://www.tmdc.org/mactech/
>
>PS: Explore your Mac!




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

Date: Mon, 15 Feb 1999 22:57:23 +0000
From: Roger Berry <roger@newlabour.demon.co.uk>
Subject: Re: email to data base script
Message-Id: <32wJaHATZKy2Ew0E@newlabour.demon.co.uk>

ezdb is a superb package that can be made to do all you want and more
and the instructions make it idiot proog. Find it at 
www.ezperl.com

In article <36C0B779.6F5CA3FA@travelcom.net>, James Alspach
<james@travelcom.net> writes
>I am looking for an e-mail to database (mysql, etc...) script.  I have
>an activation form on a web page that needs to populate a database.  The
>web page is served by my ISP so I don't have direct access between my
>database and the web form.  The activation form currently mails the form
>to me and I manually enter this info into the database.  This looks like
>a job for a perl script but I may be wrong. I have never used perl but
>it seems like it may be a good fit.  My other catch is that this page
>will be on a secure site and, thus, will encrypt the e-mail before it is
>sent to me.  Basically the steps I need to take, as I see them, are:
>1> receive the email
>2> decrypt the email
>3> parse the email
>4> place the resulting data into the database
>5> respond to the message with an e-mail that gives very basic status on
>the submitted form (OK, duplicate name, missing field, etc...)
>some where in there I also need to ensure that this is not a duplicate
>e-mail (perhaps the database could handle that by setting one of the
>fields to unique), I also need to collect the messages from the database
>regarding whether or not the message was entered correctly.
>I hope someone can give me some direction.
>thanks
>james
>
>--
>
>
>James Alspach
>Platform Systems Administrator
>Travel Communications Company
>www.travelcom.net
><james@travelcom.net>
>
>
>[ A MIME text / x-vcard part was included here. ]
>

-- 
Roger Berry


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

Date: Tue, 16 Feb 1999 23:36:04 -0000
From: "TCPS News" <news@redland.azariah.org.uk>
Subject: How to get Telnet 'header' Information from a Perl
Message-Id: <7acvgh$pha$1@news1.cableinet.co.uk>

Hello

I'd like to have my perl script telnet to a host and grab the information
that is presented before the login prompt, and then exit from the telnet
session without logging on - this information includes the OS type and
version which is what I want to get.

How can my perl script perform this and save the text as a string?

Thank you.

--
Andrew Hearn
news@redland.azariah.org.uk




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

Date: Tue, 16 Feb 1999 23:51:07 +0000
From: Andy Mendelsohn <andy@focus-consulting.co.uk>
Subject: Re: How to get Telnet 'header' Information from a Perl
Message-Id: <36CA046B.66D97E27@focus-consulting.co.uk>

TCPS News wrote:
> 
> Hello
> 
> I'd like to have my perl script telnet to a host and grab the information
> that is presented before the login prompt, and then exit from the telnet
> session without logging on - this information includes the OS type and
> version which is what I want to get.
> 
> How can my perl script perform this and save the text as a string?
> 
> Thank you.
> 
> --
> Andrew Hearn
> news@redland.azariah.org.uk

take a look at the Net::Telnet module on cpan. Use the getline or
getlines methods to return the information you want to a string.


Andy Mendelsohn


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

Date: Tue, 16 Feb 1999 16:16:25 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how to sort by file date with year
Message-Id: <pnqca7.rb5.ln@magna.metronet.com>

Steve . (syarbrou@nospam.enteract.com) wrote:
: I have a list of files with the year in it.  I want to sort from
: newest to oldest.  Thought of a system call with a reverse listing,
: but didn't work, because it doesn't account for the year the way I
: want.  Basically it looks like this:
:  
: PC122198 
: PC010799

: Linux/UNIX thinks that 122198 is newer because technically it's a
: larger number.  


   No "technically" about it.

   122198 just plain _is_ a larger number than 010799.

   But you don't _have_ numbers.

   You have (non-y2k compliant) dates.


: How would you do a sort so that it sets the second
: file as the newer one in the list? 


   I would try to apply the answer to the FAQ on sorting
   to my situation:

   Perl FAQ, part 4:

      "How do I sort an array by (anything)?"


   If you get stuck, then post your code and someone will
   likely help you fix it.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 16 Feb 1999 22:52:24 GMT
From: dwarren@thebigwave.net
Subject: LWP and B Module
Message-Id: <7acsr4$jh0$1@nnrp1.dejanews.com>

Greetings All,

Has anyone successfully gotten a script written with LWP to compile and
execute?  A simple testscript:

#!/usr/local/bin/perl

use LWP::Simple;

getprint "http://www";

Runs fine, compiles fine, but when one attempts to execute it, the following
is returned:

Can't locate object method "new" via package "HTTP::Request".

Similiar errors involving the new method occur when I try a more complex
program that uses UserAgent.  Any help would be appreciated.  In particular
any pointers to information on the B module in example.  (I've read what
comes w/the perl source in the lib/B directory already.)

-Doug

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 16 Feb 1999 23:48:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: none
Message-Id: <7ad04j$dvc$1@client2.news.psi.net>

soft4u@bigfoot.com (soft4u@bigfoot.com) wrote on MCMXCIII September
MCMXCIII in <URL:news:99214941.00031@mail.nomailserver.com>:
:: 
:: Hi,
:: We have for sale various apps for the PC.
:: All softwares with removed the protection.
:: 
:: WORLD CONSTRUCTION SET v3


Now, given that God had WORLD CONSTRUCTION SET v1, and you have
WORLD CONSTRUCTION SET v3, who had version 2?



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


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

Date: 16 Feb 1999 23:46:41 GMT
From: "Arno Bogaard" <arno_22@hotmail.com>
Subject: Opening en printing text files with variables
Message-Id: <7ad011$ltj@news3.euro.net>

I've got this code:

    $var = "Even more blabla";

    open (FILE, "text.txt");
    while (<FILE>) {
        print "$_";
    }

and this "text.txt" file:

    Hi everybody
    This is a variable: $var
    This is the end of this textfile

Problem:

When perl prints $_ it doesn't change $var into 'Even more blabla
How to solve it?

Arno Bogaard, arno_22@hotmail.com




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

Date: Tue, 16 Feb 1999 21:06:03 GMT
From: aixgod@ix.netcom.com
Subject: Perl evangelism
Message-Id: <7acmjk$dku$1@nnrp1.dejanews.com>

Hi, this is a general call for help in getting together some documents,
articles, and information showing the benefits of Perl (and apache and
mod_perl).

Currently, one of the companies I work for is on a kick to reduce everything
to one platform (NT) and one set of programming "frameworks" (Visual Studio -
VB primarily ... some J++).  The idea being that the company is already a
"Microsoft Shop" (because it uses Office...yeah, I know, I have no idea why
that makes a difference).  The argument goes that reducing the # of platforms
and development environments makes long-term support and hiring cheaper.  The
case is being made uses a variety of articles from the industry watchgroups
(Gartner, etc.), promotional material by Microsoft (yeah, that's real
unbiased), and listings of websites using IIS and ASP.

We have a fairly large web app written in Perl using Apache as the web server
(mod_perl).  The thing works great and we never spent a dime on software.
However, suddenly we have to justify it's existence.  I would appreciate any
pointers to any information that anyone can provide related to Perl (or
Apache).  For example, major web sites (like Human Genome or Dejanews) that
use Perl.  Statistics related to the % of sites on the web using Perl.	Any
type of reports from Gartner/Forrester/Aberdeen/blahblahblah that are
favorable for Perl or Apache or open-source in general.  Any direct
comparisons between perl/mod_perl and asp/vbscript.  Third party stuff is
much preferable to your own personal opinions (stands up better to scrutiny
;-).

Please help with anything you know of.  Once we have assembled our document
we'll repost it out for others to use in case they run across the same
situation.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 16 Feb 1999 16:43:40 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: aixgod@ix.netcom.com
Subject: Re: Perl evangelism
Message-Id: <36C9F49C.341C90EA@mail.uca.edu>

[cc'd to a]

Well, this reference came up on the one of the Perl for Win32 lists
today, maybe it'll help you:

http://www.microsoft.com/sitebuilder/magazine/clinick_perl.asp

>From the 800-pound gorilla's mouth about Perl.

Cameron
camerond@mail.uca.edu

aixgod@ix.netcom.com wrote:
> 
> Hi, this is a general call for help in getting together some documents,
> articles, and information showing the benefits of Perl (and apache and
> mod_perl).


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

Date: Tue, 16 Feb 1999 21:43:11 GMT
From: vasanthraghavan@hotmail.com
Subject: Perl script for processing JCLs
Message-Id: <7acopc$fpt$1@nnrp1.dejanews.com>

hi,
   has anyone written any Perl scripts to process a file that has JCL
statements? are there any websites for such scripts that i can look into? any
kind of pointers will be a lot useful .

thanks,
vasanth.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 16 Feb 1999 14:55:48 -0800
From: mark_nutini@opcode.com (Mark Nutini)
Subject: Re: Problem with UPLOAD files by perl !??
Message-Id: <mark_nutini-1602991455480001@208.244.213.42>

In article <34e836fb.5313680@news.inet.co.th>, burningboy@hotmail.com
(James  Bond  098) wrote:

> Ah....
> I've written a perl script for uploading files.
> IT's
> 
> require "cgi-lib.pl";
> $data=$in{'data'};
> 
> open(file,">anyname.jpg");
> print file $data;
> close(file);
> 
> But...... Do you know how to change "anyname.jpg" to the real name
> of file(from the client), such as , sending a file named "test.txt"
> the my script save it to "test.txt", not "anyname.jpg" !!?

I used the following routine with cgi-lib.pl.

sub rename_file {
   
   # path to the upload directory
   my $directory = '/home/httpd/htdocs/uploads/';
 
   # save the uploaded filename path. I use a single item array so I can
pass the value
   # to the unlink command to delete the file
   # example from win browser
'/home/httpd/htdocs/uploads/upload_C:\files\fred.gif'
   # example from mac browser '/home/httpd/htdocs/uploads/upload_fred.gif'

   my $filepath[0] = $in{'filename'};
   
   # Windows browsers add directory garbage to filenames
   # change dos directory char '\' to unix '/'(DAMN WINDOWS!)
   # this will make it easier to parse

   $in{'filename'} =~ s/\\/\//g;
   
   # remove upload_ tag (this name is set by cgi-lib.pl)
   # the windows upload_ tag gets parsed above.
   # this handles a Mac upload

   $in{'filename'} =~ s/upload_//g;

   # split the unix path along the "/" delimiter

   my @path = split (/\//,$in{'filename'});
   my $number = @path;
   
   # the filename is the last item in the array.
   my $origname = $path[$number-1];
   
   # read the uploaded file into memory.
   open (NEWFILE, "$filepath[0]") or die "Could not open $filepath";
   binmode NEWFILE;
      my @data=<NEWFILE>;  #get contents of uploaded file.
   close(NEWFILE);
   
   # create a new file with the original pre-uploaded name and write the
data to it.
   open (OUTFILE, ">$directory$origname") or die "Could not open
$directory$origname";
   binmode OUTFILE;
      
      foreach $fileline (@data){
      
         print OUTFILE $fileline;
      
      }
      
   close(OUTFILE);
   
   # delete the old file
   unlink @filepath;
}
Mark Nutini
mnutini@opcode.com


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

Date: 16 Feb 1999 18:56:25 -0500
From: kdp@nntp.hom.net (Keith Phillips)
Subject: Re: Python vs. Perl vs. tcl ?
Message-Id: <36ca05a9@news>

On Tue, 16 Feb 1999 15:18:35 GMT, droby@copyright.com <droby@copyright.com>
spoke unto us, saying:
>In article <wkaeym6pxl.fsf@ifi.uio.no>,
>  Lars Marius Garshol <larsga@ifi.uio.no> wrote:
>> | It (Python) also seems to have some awkward non-intuitive syntax.
>> | For example, to avoid a newline after the output of a print
>> | statement, you add a trailing comma. Now, that is not what I would
>> | call intuitive (does it remind of me of Basic??) .. another example,
>> | to construct a tuple of one item, add a comma .. again .. not very
>> | intuitive.
>>
>> I agree that these are weak points in the syntax. However, I can't
>> really think of any better alternatives myself, and also, they are in
>> parts of the language I rarely need. So thankfully the damage is
>> limited. (And, yes, it reminds me too of Basic, although the varieties
>> I've used used ';' instead of ','.)
>>
>
>Actually, I think most Basics use both.  When printing multiple things
>without quoting, you separate by commas if you want tabs in between and by
>semicolons if you don't.  At the end of the print you get a newline by
>default, but using a comma or semicolon prevents the newline and continues
>the separation behavior described above to the next print.
>
>At least that's the way I remember it from my days long ago with the PDP-11
>and RSTS, and I think it was the same on early DOS Basics.  I haven't looked
>at the current stuff.
>
>Ugly.

You are correct, sir.  Visual Basic *still* uses the comma-for-tab and
semicolon for concatenation.  And it's still ugly.

Keith Phillips, kdp@hom.net
-----BEGIN GEEK CODE BLOCK -----
Version 3.1
GB d+(-) s: a C++ UL+>++ P+++$ L++>+++ E--- W+ N++ o K? w-- O? M-- V--
PS+ PE Y+ PGP? t+ 5 X? R? tv+ b+++ DI++ D+ G e++ h---- r+++ y++++
-----END GEEK CODE BLOCK ------


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

Date: Tue, 16 Feb 1999 16:52:24 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regex Expansion and Metrics
Message-Id: <8rsca7.8t5.ln@magna.metronet.com>

dmulholl@cs.indiana.edu wrote:

: is there a routine that can return an
: integer value for the number of possible expansions of an arbitrary regex?


   What number should it return for      /a*/    ???

   that has an _infinite_ number of possible expansions...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 16 Feb 1999 17:54:35 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Ekkis <ekkis@arix.com>
Subject: Re: removing blank lines in a multiline string?
Message-Id: <36C9F72B.D13970C9@giss.nasa.gov>

Ekkis wrote:
> 
> and short of converting it to an array and recomposing the string (yuk!) I
> think there must be some clever way to do this

I don't find this yucky at all:

@s = split /\n+/, $s;     
print join '\n', @s;

hmm... three regex's?

$s =~ s#\n+#\n#g;
$s =~ s#^\n##g;
$s =~ s#\n$##g;

 ...no, now that's yucky.  I dunno.

	Jay Glascoe
--  
"That's the one that got me!"
	-- Peter Venkman, Ghostbuster


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

Date: 16 Feb 1999 18:26:20 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: removing blank lines in a multiline string?
Message-Id: <39r9rque03.fsf@ibnets.com>

>>>>> "JG" == Jay Glascoe <jglascoe@giss.nasa.gov> writes:

  JG> @s = split /\n+/, $s;     
  JG> print join '\n', @s;

  JG> $s =~ s#\n+#\n#g;
  JG> $s =~ s#^\n##g;
  JG> $s =~ s#\n$##g;

just do it the easy way:

	$s =~ tr/\n//s ;

hth,

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Tue, 16 Feb 1999 17:37:10 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Barry Brevik <barry@smtek.com>
Subject: Re: Variable interpolation w/regex
Message-Id: <36C9F316.8675DEAA@giss.nasa.gov>

[courtesy copy of post sent to cited author, Barry, via email]

hi Barry,

Barry Brevik wrote:
> 

<snip>

>   if ($inbuf =~ $test)

first I'll give ya one o' these: perldoc -f eval
 ...
okay, now I'll answer the question  ;)

here's what I'd do.  Say we have a pattern, e.g. "/(fo+)/", in $pattern.
Now let's try:

# if each $pattern is only to be used once
eval("$inbuf =~ $pattern");

# if each $pattern is to be used several times
$my_matcher = eval("sub { shift =~ $pattern }");

# if each $pattern is to be used several times,
# and $pattern is to take on several values
sub my_matcher_maker { eval("sub { shift =~ $_[0] }") }

# examples
$foo = "/(fo+)/";
$foo_matcher = eval("sub { shift =~ $foo }");
print &$foo_matcher("foo");
print &$foo_matcher("biz");

chomp($thing = <FH>);
$my_matcher = my_matcher_maker($thing);
print &$my_matcher("hi, hello, hi....\n");

	Jay Glascoe
--  
	MSDOS was created to keep idiots away from Unix


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

Date: Tue, 16 Feb 1999 22:13:56 GMT
From: Ravindran_Abhilash <Abhilash.Ravindran@compaq.com>
Subject: y2k problems with perl
Message-Id: <36C9F037.2175F6FC@compaq.com>

Hi,


Functions gmtime and localtime seems to have problems with year >= 2000.
For example the time corresponding to year 2000, the year is returned as
100 instead of 00.

Does anybody have more information on this?

Thanks,

Abhi


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

Date: Tue, 16 Feb 1999 17:58:30 -0500
From: "Allan M. Due" <allan@due.net>
Subject: Re: y2k problems with perl
Message-Id: <FKmy2.24$986.353@nntp1.nac.net>

Ravindran_Abhilash wrote in message <36C9F037.2175F6FC@compaq.com>...
:Hi,
:Functions gmtime and localtime seems to have problems with year >= 2000.
:For example the time corresponding to year 2000, the year is returned as
:100 instead of 00.

:Does anybody have more information on this?


Um, wait.  Have you seen so many manifestations of the Y2k problem that you
expect it to manifest.  Are you saying that you are in the Y2k fix biz and
want perl to have problems? <g>

1900 = 00
2000 = 100
2100 = 200

This is what I consider correct behavior, but maybe that is just me.

HTH

AmD


:
:Thanks,
:
:Abhi




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

Date: Tue, 16 Feb 1999 23:00:12 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: y2k problems with perl
Message-Id: <0Mmy2.432$k_5.73470@news.shore.net>

Ravindran_Abhilash <Abhilash.Ravindran@compaq.com> wrote:
: Functions gmtime and localtime seems to have problems with year >= 2000.
: For example the time corresponding to year 2000, the year is returned as
: 100 instead of 00.

: Does anybody have more information on this?

Here we go again.

Localtime returns 100 for the year 2000 because it *doesn't* have a year
2000 problem. Get it? If not, read the docs, or check DejaNews for the
last 2,000 times it's been discussed in this newsgroup. 

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Tue, 16 Feb 1999 23:01:56 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: y2k problems with perl
Message-Id: <slrn7cju9l.6c.alastair@calliope.demon.co.uk>

Ravindran_Abhilash <Abhilash.Ravindran@compaq.com> wrote:
>Hi,
>
>
>Functions gmtime and localtime seems to have problems with year >= 2000.
>For example the time corresponding to year 2000, the year is returned as
>100 instead of 00.
>
>Does anybody have more information on this?

RTFM comes to mind. You did check the man page didn't you?

Dejanews also springs to mind.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 16 Feb 1999 23:14:14 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: y2k problems with perl
Message-Id: <slrn7cjv31.svo.fl_aggie@enso.coaps.fsu.edu>

On Tue, 16 Feb 1999 23:00:12 GMT, Scratchie <upsetter@ziplink.net> wrote:

+ check DejaNews for the last 2,000 times it's been discussed in this
                              ^^^^^
Is that what they mean by the Y2K problem??

James


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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