[7415] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1040 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 17 16:07:20 1997

Date: Wed, 17 Sep 97 13:00:24 -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, 17 Sep 1997     Volume: 8 Number: 1040

Today's topics:
     Re: does \1 \2 \3 work? (my mistake is..where..?) <rootbeer@teleport.com>
     Re: DOS version of PERL 5? (Petr Prikryl)
     Re: Efficiency/New Perl Book: return @array vs \@array? (Dave Wolfe)
     Forms:Variable number of input values NOSPAMrgrasser@acm.org
     Re: GDBM tie works from cmdline but not WWW?? <rootbeer@teleport.com>
     Re: Help me with this pls <rjo100@york.ac.uk>
     Re: homogenous/nonhomogenous list test? <rbush@up.net>
     Re: homogenous/nonhomogenous list test? <chapman@techctr.buddcompany.com>
     Re: How to append CGI parms to a file (newbie) (Harold Bamford)
     Re: How to append CGI parms to a file (newbie) <rootbeer@teleport.com>
     How to use POST method to call a CGI script from Perl? x@apocalypse.org
     HTTP Client Question <dontspam_davidla@inquo.com>
     Re: Newbie question about system function (Andrew Pitman)
     Re: Newbie question about system function (Andrew Pitman)
     Re: Perl Conference notes by Gunther (Java frontend - p (Peter Haworth)
     Perl, Orapel, Web Interfaces (G. Dimitoglou)
     Re: problem with regular expressions <rootbeer@teleport.com>
     REGEXP: Quickie Newbie Inquiry <dj_soler@pnl.gov>
     Re: REGEXP: Quickie Newbie Inquiry (Matthew Cravit)
     Re: Script to Capitalize HTML Tags (Tad McClellan)
     Re: Script to Capitalize HTML Tags (Nigel Reed)
     simple script <jmedlen@lpd.sj.nec.com>
     Re: Validating e-mail addresses submitted via form <rootbeer@teleport.com>
     Re: Value within range? (Tad McClellan)
     Re: Value within range? <rootbeer@teleport.com>
     Re: Value within range? (Terry Michael Fletcher - PCD ~)
     Re: Win NT and PERL HELP!!!!!!! tlowery@dsacng1.dsdc.dla.mil
     Re: Win32 Perl FAQ Addition? (WAS Re: Is Perl for Win32 <rootbeer@teleport.com>
     Re: Yknow, the thing about perl is.... (Terry Michael Fletcher - PCD ~)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Sep 1997 12:30:05 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Eli the Bearded <usenet-tag@qz.little-neck.ny.us>
Subject: Re: does \1 \2 \3 work? (my mistake is..where..?)
Message-Id: <Pine.GSO.3.96.970917121056.28240V-100000@julie.teleport.com>

On 16 Sep 1997, Eli the Bearded wrote:

> In any case I think using backreferences in a character class is broken
> programming. I couldn't get it to work with perl5.00401, though it did
> not give me any warnings either.

That's because you weren't using backreferences. :-)  What looks like a
backreference in a character class is simply a character specified in
octal, so no warning is needed.

> If the character class were empty at (RE) compile time, it would be
> a fatal error, 

Actually, I don't think it's possible to make an empty character class,
since the right bracket isn't special as the first character of a
character class. The /x modifier doesn't change that, AFAIK. Is there a
way I'm not thinking of? 

Of course, there is an error if you use an inverted range.

    /[z-a]/		# Bad regexp!

But these work. If, of course, they do what you want them to do! :-)

    /[[-]]/

    /[] (-: []/

Somebody should add the /x modifier, dress these up a little more, and use
them in the Obfuscated Perl Contest next year.

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 17 Sep 1997 18:17:36 GMT
From: prikryl@dcse.fee.vutbr.cz (Petr Prikryl)
Subject: Re: DOS version of PERL 5?
Message-Id: <5vp6s0$4ih$2@boco.fee.vutbr.cz>

Rachel Holmes (rachelh@nortel.ca) wrote:
>Hi
>Is there a version of perl available for DOS, that is 100% compatible
>with unix perl 5?
>If not, is there a version for DOS that is not 100% compatible? :)

Check the Ilya Zakharevich's port of Perl 5.004+. You may find
the instalation support at http://www.fee.vutbr.cz/~prikryl/tools.html

The Perl port probably is fully compatible with the Unix one;
however, DOS is a different operating system and it do not
support services which Unix do. In other words, if you expect
the same results when crunching texts, you will be satisfied.
If you expect to use TCP/IP connections, calling other
OS utilities and similar things which are not the part of
Perl in Unix (because they are supported by the system itself),
you may be disgusted -- by DOS ;-)

Petr

P.S. I have received the Ilya Zakharevich's suggestion of using the Perl 
     itself during the instalation -- as it is done in OS/2. I will try
     it later (very busy now).

--
Petr Prikryl (prikryl@dcse.fee.vutbr.cz)   http://www.fee.vutbr.cz/~prikryl/
TU of Brno, Dept. of Computer Sci. & Engineering;    tel. +420-(0)5-7275 218


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

Date: 17 Sep 97 17:37:53 GMT
From: dwolfe@miaow.sps.mot.com (Dave Wolfe)
Subject: Re: Efficiency/New Perl Book: return @array vs \@array?
Message-Id: <dwolfe.874517873@talos4>

[ Courtesy Cc e-mailed ]

In <83AC84ABDA31E740.DD50D546A3DC9FDA.D364DD521A9D1968@library-proxy.airnews.net> Harold Todd Chapman <chapman@techctr.buddcompany.com> writes:

>I am studying the new "Advanced Perl Programming" book. On page 9 it
>says that large amounts of data can be efficiently passed to and from
>subroutines by using references. Then on page 10 the use of the
>Benchmark module is demonstrated. I used the program below to test this
>and found that the reference returning version take 50% longer than the
>array returning version. Am I doing something wrong? Comments?

[...]
>timethis(1000000, "iso_xy()");

>sub iso_xy {
>        return @points;
>	#return \@points; #if I uncomment this line and comment above
>			  #the benchmark take 50% longer!
>}

I suspect your array size is too small to be significantly different
than a single scalar (which is what the reference return is), but more
significantly, Perl is apparently optimizing away all the time consuming
work since you don't use the return value(s) in your benchmark. Below is
my benchmark program an the results. I had to keep cutting down the
array size and the iterations because I got impatient waiting on the
array returns to complete. Looks to me like more than 2 orders of
magnitude difference. :-)

use Benchmark;

@array = (1..100);

sub rtn_array {
    return @array;
}

sub rtn_ref {
    return \@array;
}

sub last_array {
    @array;
}

sub last_ref {
    \@array;
}

timethese(10000, {
	"\nExplicitly return an array"          => '@x = rtn_array()',
	"\nExplicitly return a ref to an array" => '$x = rtn_ref()',
	"\nImplicitly return an array"          => '@x = last_array()',
	"\nImplicitly return a ref to an array" => '$x = last_ref()',
    });

Benchmark: timing 10000 iterations of 
Explicitly return a ref to an array, 
Explicitly return an array, 
Implicitly return a ref to an array, 
Implicitly return an array...

Explicitly return a ref to an array:  0 secs ( 0.30 usr  0.00 sys =  0.30 cpu)
            (warning: too few iterations for a reliable count)

Explicitly return an array: 38 secs (37.45 usr  0.00 sys = 37.45 cpu)

Implicitly return a ref to an array:  0 secs ( 0.24 usr  0.00 sys =  0.24 cpu)
            (warning: too few iterations for a reliable count)

Implicitly return an array: 38 secs (37.12 usr  0.00 sys = 37.12 cpu)

-- 
 Dave Wolfe


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

Date: Mon, 15 Sep 97 18:23:31 GMT
From: NOSPAMrgrasser@acm.org
Subject: Forms:Variable number of input values
Message-Id: <5vju2p$d0g@slider.bme.ri.ccf.org>

Hi gurus - 
I am building a form application that takes values from a form
and builds a file (i.e. a sql script).  The first 15 or so values
are required - that is - they must exist.  After that, they do not
have to exist.  However, once one value is null, all the rest
will be null.  I would like to be able to examine the incoming
values, put the existing ones in a file, and exit on the 
first null value.  

I suspect I am missing something obvious - can anyone
point me in the right direction?

perl -v: This is perl, version 5.004_01
Running on Solaris 2.5

Thanks for your help.
Becky G
rgrasser at acm dot org



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

Date: Wed, 17 Sep 1997 12:31:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Neal Kaiser <neal@valinet.com>
Subject: Re: GDBM tie works from cmdline but not WWW??
Message-Id: <Pine.GSO.3.96.970917123041.28240W-100000@julie.teleport.com>

On Tue, 16 Sep 1997, Neal Kaiser wrote:

> ..works great via cmd line.
> 
> Doesn't work via the web. 

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to
solving such problems. It's available on the perl.com web pages. Hope
this helps!

   http://www.perl.com/perl/
   http://www.perl.com/perl/faq/
   http://www.perl.com/perl/faq/idiots-guide.html

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 16 Sep 1997 21:26:40 +0100
From: Russell Odom <rjo100@york.ac.uk>
To: Charles Wee Chun Chiang <cc.wee@student.qut.edu.au>
Subject: Re: Help me with this pls
Message-Id: <341EEB80.2CC86054@york.ac.uk>

Charles Wee Chun Chiang wrote:
> 
> if any of these fields are not filled in then there will be an error
> message asking users to try again. I use the following code to do this:
> 
>         $destadd=$in{'to'};
>         $fromadd=$in{'from'};
>         $Subject=$in{'Subject'};
>         $Answer=$in{'Answer'};
> 
>         unless($destadd && $fromadd && $Subject &&Answer)
                                                   ^^^
Aha! You're missing a '$' in front of 'Answer'. Try:

          unless($destadd && $fromadd && $Subject &&$Answer)
                                                   ^^^
>         {
>           Error messages asking users to retry again
>         }
>           print "Your email has been sent";
>         }
> 
>         This code that i wrote is able to test for empty destadd, fromadd and
> subject fields but cannot detect an empty Answer field.

HTH,

Russ

---------------------------------------------------------------------
--[ R u s s e l l    O d o m ]---[ *NEW:* mailto:russ@mail.org.uk ]--
--[  University of York, UK  ]---[ http://www.york.ac.uk/~rjo100/ ]--
---------------------------------------------------------------------
--[    FAQ maintainer, news:comp.os.ms-windows.win95.moderated    ]--
---------------------------------------------------------------------




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

Date: Wed, 17 Sep 1997 14:22:21 -0400
From: "Raymond K. Bush" <rbush@up.net>
Subject: Re: homogenous/nonhomogenous list test?
Message-Id: <34201FDD.5BF3@up.net>


Ian Baker wrote:
> 
> Raymond K. Bush (rbush@up.net) wrote:
> :
> : Is there an efficient way i can check to see if a list of names is
> : homogenous.  A 1-4 liner please.  Right now i am using a foreach and an
> : if but somehow this seems like the wrong way and slow if the list (
> : rather LoL) is big (20000 entries per list and around 8000 lists so you
> : can see why it's important to speed this bugger up).  Is a foreach/if
> : loop the best that can be done (ps i return when i find one entry not
> : like the others)?
> :
> : i have lists of names
> :
> : @names=("a","a","a","a","a","a","a","a");
> : @names2=("a","a","a","a","a","a","c","a","a");

Would something using joins and splits (like  below) be faster?  I can
change how the array generator works so it outpus delimited strings so i
guess the question is weather a split and a join is faster than a
foreach with an if in the middle.

perl -e ' @names2=("a","a","a","a","a","a","a","a","a");$n=pop(@names2);
$nm=join("",@names2);@t=split($n,$nm); $t=join("",@t); print
length($t)," \n";'

0 

perl -e ' @names2=("a","a","a","a","a","a","a","c","a");$n=pop(@names2);
$nm=join("",@names2);@t=split($n,$nm); $t=join("",@t); print
length($t)," \n";'

1 

Can i use the benchmark module on the command line (haven't tried)?

> 
> the only other way i can think of to do that, offhand, is to sort the list
> and check the first and last values and see if they're the same...
> 
> the foreach/if is significantly faster, i think.  :)
> 
> -Ian

-- 
--Ray
 .70~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~07.
      --- reply to rbush - at - up - dot - net ---
--- please include indication of past correspondence ---
      --- in order to receive a faster response ---


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

Date: Wed, 17 Sep 1997 15:15:53 -0400
From: Harold Todd Chapman <chapman@techctr.buddcompany.com>
Subject: Re: homogenous/nonhomogenous list test?
Message-Id: <23C60761A1C50D8A.379FF5F6F7658747.411FA3604AEE5591@library-proxy.airnews.net>

Raymond K. Bush wrote:
> 
> Is there an efficient way i can check to see if a list of names is
> homogenous.  A 1-4 liner please.  Right now i am using a foreach and an
> if but somehow this seems like the wrong way and slow if the list (
> rather LoL) is big (20000 entries per list and around 8000 lists so you
> can see why it's important to speed this bugger up).  Is a foreach/if
> loop the best that can be done (ps i return when i find one entry not
> like the others)?
> 

The method you pick has alot to do with what you data sets typically
look like. A method that is very fast on one data set could be very slow
on another.

The following method might be worth trying. Atleast the storage
requirements are very low.

foreach (@names) {
   $hash{$_} = 1;
      if (scalar(keys(%hash)) > 1) { print "non-homogenous\n"; last; }
}

-Chaka


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

Date: 17 Sep 1997 18:40:31 GMT
From: hbamford@marconi.ih.lucent.com (Harold Bamford)
Subject: Re: How to append CGI parms to a file (newbie)
Message-Id: <5vp86v$iig@ssbunews.ih.lucent.com>


In article <5vnek2$cli@bgtnsc02.worldnet.att.net>,
Jason Hogg <Jason.Hogg@worldnet.att.net> wrote:

>I am new to Perl, and wondered if any one could please point me to some
>sample Perl code that simply copies all the parameters from an HTML form
>(using the POST method) to the end of a flat file located on a Unix server.

#Use the CGI.pm module for your CGI programming
use CGI;
use strict;

my($query) = new CGI;

  ...  blah ...

  [ display form, get form values back in $query upon submit ]

  ... blah ...

  open('FILE',">>myfile") or die("Could not open myfile for append, $!");
  $query->save('FILE');
  close('FILE');

The file will contain ALL of the CGI parameters in keyword=value format.

-- Harold
-- 
Harold Bamford
mailto:hbamford@lucent.com
(630)713-1351
http://nwswww.ih.lucent.com/~hbamford/


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

Date: Wed, 17 Sep 1997 12:32:44 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Hogg <Jason.Hogg@worldnet.att.net>
Subject: Re: How to append CGI parms to a file (newbie)
Message-Id: <Pine.GSO.3.96.970917123210.28240X-100000@julie.teleport.com>

On 17 Sep 1997, Jason Hogg wrote:

> I am new to Perl, and wondered if any one could please point me to some
> sample Perl code that simply copies all the parameters from an HTML form
> (using the POST method) to the end of a flat file located on a Unix server.

There should be something like this in the docs for CGI.pm.

I think you could use the methods in Randal's fourth Web Techniques
column, which explains how to use flock() to avoid problems when multiple
processes need to modify one file. Hope this helps! 

   http://www.stonehenge.com/merlyn/WebTechniques/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 17 Sep 1997 14:42:29 -0600
From: x@apocalypse.org
Subject: How to use POST method to call a CGI script from Perl?
Message-Id: <874524511.32135@dejanews.com>

How would I use Perl to send a bunch for form data from a CGI
script using the POST method, rather than encoding everything in
a URL...

I've been doing something like this:
 print "location: http://domain.com/cgi-bin/script.pl?v1=sdfsdfsdfsdf&..";
and I don't trust it for sending paragraphs of data (how many chars
can a URL be, anyway?).

Is it possible to just invoke a CGI script using POST like a browser
does from within a perl script itself?

Also, for when I've got small data sets, how would I convert
all the non-alphanumeric characters in a string to the hex format
browsers seem to like: (i.e. %xx)

Thank you muchly.

  - Xochi

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 17 Sep 1997 11:30:04 -0600
From: David Lawrence <dontspam_davidla@inquo.com>
Subject: HTTP Client Question
Message-Id: <3420139C.228A@inquo.com>

In order to facilitate submission of Web pages to the Infoseek search
engine, I'm writing an HTTP client that will do it automatically.  The
client connects to www.infoseek.com, then sends the following (where
$SUBMITURL is the url to be sent):

-------------- start of what is sent (GET etc. is on one line):
GET
www.infoseek.com/AddURL/addurl?sv=IS&lk=noframes&nh=10&url=$SUBMITURL&ud5=Add%2FUpdate+URL&pg=URL.html
HTTP/1.0^M
Referer: http://www.infoseek.com/AddUrl?pg=DCaddurl.html^M
Connection: Keep-Alive^M
User-Agent: Mozilla/3.01 (WinNT; I)^M
Pragma: no-cache^M
Host: www.infoseek.com^M
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*^M
^M
--- end of what is sent

It listens to the response until disconnected by the server.

The response indicates that the page has been scheduled for indexing. 
It even gives a URL to go to in order to check on the status of
indexing.  When I go to that URL, however, it appears as though the
server has never heard of that URL at all.

Am I missing some bit of HTTP protocol here?  Or what?  There has to be
some way to completely emulate a browser with my Perl socket routine.

Thanks,
Dave


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

Date: 17 Sep 97 18:07:03 GMT
From: murdock@mis.rowan.edu (Andrew Pitman)
Subject: Re: Newbie question about system function
Message-Id: <34201c47.0@news.rowan.edu>


Kenneth G. Markus (markus@dismal.com) wrote:

: Hi everyone.

: I'm working on a script that contains a simple call to the system
: function:

: system ("c:/Winzip/winzip32.exe", " -min", " -a", " c:/ross.zip", "
: c:/web/wwwroot/pdf/pit.pdf\n");

: which doesn't work.

: Now does system ("c:/Winzip/winzip32.exe -min -a c:/ross.zip
: c:/pit.pdf\n");

: The statement, however, does work at the command line.

Yes.  Another would be:  system "c:/Winzip/winzip32.exe", "-min", "-a", "c:/ross.zip", "
c:/web/wwwroot/pdf/pit.pdf\n"); 

--
Andrew

|_    _  _    _  _          _|  _   _ |_
| ). ( )( ). ( )( ) (_) |~ (_| (_) (_ |\
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                _
All unsolicited e-mail received will be           /\   (_)
subject to a $500 proofreading fee, as       /\  /^^\  /|\ 
per: U.S. CODE TITLE 47, SEC 227(b)(1)(C).  /^^\/    \/\ 
___________________________________________/   /     /  \___


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

Date: 17 Sep 97 18:11:23 GMT
From: murdock@mis.rowan.edu (Andrew Pitman)
Subject: Re: Newbie question about system function
Message-Id: <34201d4b.0@news.rowan.edu>


Andrew Pitman (murdock@mis.rowan.edu) wrote:
: Kenneth G. Markus (markus@dismal.com) wrote:

: : Hi everyone.

: : I'm working on a script that contains a simple call to the system
: : function:

: : system ("c:/Winzip/winzip32.exe", " -min", " -a", " c:/ross.zip", "
: : c:/web/wwwroot/pdf/pit.pdf\n");

: : which doesn't work.

: : Now does system ("c:/Winzip/winzip32.exe -min -a c:/ross.zip
: : c:/pit.pdf\n");

: : The statement, however, does work at the command line.

: Yes.  Another would be:  system "c:/Winzip/winzip32.exe", "-min", "-a", "c:/ross.zip", "
: c:/web/wwwroot/pdf/pit.pdf\n"); 

Whoops!  Should have been:  system "c:/Winzip/winzip32.exe", "-min", "-a", "c:/ross.zip", 
"c:/web/wwwroot/pdf/pit.pdf";

: --
: Andrew

: |_    _  _    _  _          _|  _   _ |_
: | ). ( )( ). ( )( ) (_) |~ (_| (_) (_ |\
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                _
: All unsolicited e-mail received will be           /\   (_)
: subject to a $500 proofreading fee, as       /\  /^^\  /|\ 
: per: U.S. CODE TITLE 47, SEC 227(b)(1)(C).  /^^\/    \/\ 
: ___________________________________________/   /     /  \___

--

|_    _  _    _  _          _|  _   _ |_
| ). ( )( ). ( )( ) (_) |~ (_| (_) (_ |\
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                _
All unsolicited e-mail received will be           /\   (_)
subject to a $500 proofreading fee, as       /\  /^^\  /|\ 
per: U.S. CODE TITLE 47, SEC 227(b)(1)(C).  /^^\/    \/\ 
___________________________________________/   /     /  \___


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

Date: 17 Sep 1997 17:31:35 GMT
From: pmh@ioppublishing.com (Peter Haworth)
Subject: Re: Perl Conference notes by Gunther (Java frontend - perl cgi backend)
Message-Id: <5vp45n$pev$1@newton.ioppublishing.com>

In article <5vnol7$hbf@tensapp.sbi.com>,
	kris@doe746j (Krishnan Shankar) writes:
> Does anyone know where i can find notes/paper/details on Gunter's paper.

Try http://www.mdbusiness.com/Scripts/JavaCGI/

-- 
	Peter Haworth	pmh@edison.ioppublishing.com
Two parrots are sitting on a perch.
One asks the other, "Can you smell fish?"


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

Date: 17 Sep 1997 19:28:49 GMT
From: gdimitog@polaris.umuc.edu (G. Dimitoglou)
Subject: Perl, Orapel, Web Interfaces
Message-Id: <5vpb1h$in5@nova.umuc.edu>

Hi,

We have an Oracle 7.* RDBMS on Sun SPARC and DEC OSF systems. We are
interested in accessing this databse only from the Web. I am trying to
find the ideal (easy to install, and coding)  platform. Here is what I
have:

Option one: Using WDB. 
	It requires Oraperl which gives me installation problems errors
(the sprintf error which according to the FAQ is because there are two
universes ATT and BSD and I need to rebuild file uperl.o in the ATT
universe. How to do this is unfortunately foreign to me...(any
help appreciated)

Option two: DBI:Oracle. 
	Do I need anything else besides: my NCSA Web Server the DBI:Oracle
modeules, and my Oracle 7.* RDBMS?
Does anybody use it? Are there any sites that I can check out the final
product?

Any thoughts and help will be greatly appreciated.  I will of course
summarize the responses.

Thank you in advance.

====================================
George Dimitoglou (SAC)

SOHO ESA/NASA Project Scientist Team 
NASA/Goddard Space Flight Center
Bldg. 26, G-1, Code 682.3
Greenbelt, MD 20771
george@esa.nascom.nasa.gov
====================================



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

Date: Wed, 17 Sep 1997 12:34:46 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: MSM Lab Supervisor <SUPERVISOR@msmlab.byu.edu>
Subject: Re: problem with regular expressions
Message-Id: <Pine.GSO.3.96.970917123312.28240Y-100000@julie.teleport.com>

On Tue, 16 Sep 1997, MSM Lab Supervisor wrote:

> Hi everyone.  

Hi, Doctor Nick! (Oops, wrong newsgroup.)

> how can I make a regular expression less greedy? 

Have you looked for the word "greedy" in the perl docs?

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 17 Sep 1997 10:52:38 -0700
From: SPIRE demo account <dj_soler@pnl.gov>
Subject: REGEXP: Quickie Newbie Inquiry
Message-Id: <342018E6.41C6@pnl.gov>

I've delved into 'man perl', read Learning Perl, and listened to 90
straight minutes of Pearl Jam, and I still can't figure this out.

How do I search for a line that contains only capital letters?  So far
I'm pointing to this:

while <FETCH> {
 .
 .
 .
  if (/[^a-z0-9/./?/!/& /r/t/f/n]/) {
    print "All the world is a stage...\n";
    $First_line = $_;
  }
}

Now, if the program was working right, it would print to STDOUT "All the
world..." only once, but it's printing it for every line that has any
text in it!

I'm sure the answer to this is obvious, but if anyone can lend a hand
(and a correct REGEXP), I'd really appreciate it.

	D  ;-)

"It's never too late!  That's what they invented death for!!!"
						-W.M. "Out to Sea"


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

Date: 17 Sep 1997 11:40:49 -0700
From: mcravit@best.com (Matthew Cravit)
Subject: Re: REGEXP: Quickie Newbie Inquiry
Message-Id: <5vp87h$oge$1@shell3.ba.best.com>

In article <342018E6.41C6@pnl.gov>,
SPIRE demo account  <dj_soler@pnl.gov> wrote:
>
>How do I search for a line that contains only capital letters?  So far
>I'm pointing to this:

>  if (/[^a-z0-9/./?/!/& /r/t/f/n]/) {

The above example won't work the way you want it to, because your /r,
etc, should be \r. However, if all you want are lines containing nothing
but capital letters, you could use:

    if (/^[A-Z]+$/) {
        # Do whatever
    }

If you want capital letters and whitespace, try something like:

    if (/^[A-Z\s]+$/) {
        # Do whatever
    }

Hope this helps.

/MC

-- 
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@taos.com (work)     | time you make it.


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

Date: Wed, 17 Sep 1997 13:09:57 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Script to Capitalize HTML Tags
Message-Id: <ld6pv5.1q6.ln@localhost>

Robert Maguire (maguirer@hercules.cs.uregina.ca) wrote:
: I work with PERL and HTML a lot, and have tons of scripts I've written to
: automate a lot of the tedious taks I found myself doing when writing and
: maintaining my web sites...

: One of my habits was to always capitalize my HTML tags in my documents
: (i.e. <BODY BGCOLOR="#ffffff">, <A HREF="yaddayadda.html">, etc...).  However,
: recently I have teamed up with several people who have been writting HTML for
: me as well to lighten my load.  Unfortunately, they don't have the same habits
: as I do of capitaliziong HTML tags.

: Is there a script already out there that can do this for me or do i need to
: write one myself.  I've already got most of it written, except for just the
: right regexp or regexps to do the capitalization correctly.

: For example, conside the following HTML lines and how they should be capitalized


: With the code I've written so far, all I can get out of it are those lines where
: everything (!!) is capitalized.  Actually, all I need is to ignore whatever's
: in the quotes


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

while (<DATA>) {
   s!(</?[a-zA-Z0-9.-]+)!\U$1!g;   # do the tags
   s!([a-zA-Z0-9.-]+\s*=)!\U$1!g;  # do the attributes

   print;
}


__DATA__
<body bgcolor="#FFFFFF" background="Image1.gif">
<font face="Arial, Helvetica" color="#FF0033" size="7"><b>Affordance</b></font><br>
--------------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 17 Sep 1997 17:34:18 GMT
From: nigelr@convex.hp.com (Nigel Reed)
Subject: Re: Script to Capitalize HTML Tags
Message-Id: <5vp4aq$d3k$1@news.rsn.hp.com>

While this works, it's not foolproof though...consider this tag

<IMG SRC="graphics/myimgage.gif" ALT="this alternate tag=my picture">

ends up as

<IMG SRC="graphics/myimgage.gif" ALT="this alternate TAG=my picture">

You could just add \" after the = on the #do the attributes line, but
still not 100% foolproof either. It's a tricky one because of so many
varibles in the creation of HTML!

Not critising, just pointing out a potention problem that someone might
face if they take it "as is"!

Regards
Nigel


Tad McClellan (tadmc@flash.net) wrote:

>    s!(</?[a-zA-Z0-9.-]+)!\U$1!g;   # do the tags
>    s!([a-zA-Z0-9.-]+\s*=)!\U$1!g;  # do the attributes



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

Date: Wed, 17 Sep 1997 10:59:50 -0700
From: Jiri medlen <jmedlen@lpd.sj.nec.com>
Subject: simple script
Message-Id: <34201A96.77D1@lpd.sj.nec.com>

Hi, 

Does anybody know, how make assignmet work??
$num = system ('grep -c \'GET /HTTP\'
c:\netscape\server\httpd-80\logs\access');


Platform Windows NT 4.0
Perl 5

simple perl scrip


#!
print "content-type: text/html\n\n";
$num = system ('grep -c \'GET /HTTP\'
c:\netscape\server\httpd-80\logs\access');
$num += system ('grep -c \'GET /index.html\'
c:\netscape\server\httpd-80\logs\access');
print "$num\n"; 

result
variable num = 0

Thanks,

-Jiri-


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

Date: Wed, 17 Sep 1997 12:52:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: steve@golf.com
Subject: Re: Validating e-mail addresses submitted via form
Message-Id: <Pine.GSO.3.96.970917125048.28240c-100000@julie.teleport.com>

On Wed, 17 Sep 1997 steve@golf.com wrote:

> Can someone please tell me if they know of a library, or script which
> will check an e-mail address on the fly, submitted via a form.

No. (I'm not being mean here; I'm merely being stern.)

> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet

Good advice. Follow it in that order, and you won't go wrong. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Wed, 17 Sep 1997 12:58:34 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Value within range?
Message-Id: <ao5pv5.mn6.ln@localhost>

Craig M. Votava (craig@lucent.com) wrote:

: This is a multi-part message in MIME format.
                               ^^^^^^^^^^^^^^

How come?

Are you attaching a binary or something that requires special handling?

Please configure your "newsreader" to post plain ASCII.



: Tad-

: Thanks for the response, I now understand the problem you point out.

: However, the solution that you propose, doesn't solve my particular
: problem. The reason is that the range I want to test on is an ascii
: value that is assigned to the $range variable. I don't want to hard-code
: the "if" statement range checks as you indicate.


So don't hard code them then ;-)

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

my $range = "1..20";
my $number = 1;

#($low, $high) = $range =~ /(\d+)/g;
#($low, $high) = $range =~ /^(\d+)\D*(\d+)/;
($low, $high) = $range =~ /^(\d+)\.\.(\d+)/;


if ( $number >= $low && $number <= $high )
   {print "yes\n"}
else
   {print "no\n"};
-----------------------------


: What I'm looking for is the best (most efficient, speedwize) to do this
: range check, given the fact that the range is an ascii value assigned
: to the $range variable.

: Once again, all help is much appreciated!

: Thanks

: -Craig


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Wed, 17 Sep 1997 12:40:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Craig M. Votava" <craig@lucent.com>
Subject: Re: Value within range?
Message-Id: <Pine.GSO.3.96.970917123801.28240a-100000@julie.teleport.com>

On Wed, 17 Sep 1997, Craig M. Votava wrote:

> the range I want to test on is an ascii value that is assigned to the
> $range variable. I don't want to hard-code the "if" statement range
> checks

You mean, you want to find out whether an ascii value is between two
bounds, but the bounds won't be known until runtime. Right?

If so, just convert the ascii value to a number (using ord), then use code
like Tad's. 

If you mean that you want to start with a range in a string, like
"123..234", just parse that string to get the numbers out of it. 

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 17 Sep 1997 18:48:17 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Value within range?
Message-Id: <5vp8li$3b$1@news.fm.intel.com>


Craig M. Votava (craig@lucent.com) so eloquently and verbosely pontificated:
> ---------------------------------------------------------------------
> #!perl -w
> 
> my $range = "1..20";
> my $number = 35;
> 
> if($number =~ /[$range]/) {print "yes\n"} else {print "no\n"};
> ---------------------------------------------------------------------- 

in that regular expression, you have a character class inside the []
square brackets.  remember that it is a giant single-character OR.  your
code creates [1234567891011121314151617181920] which is effectively the
character class [0-9] or [\d] or simply \d.  therefore any $number will
print "yes".  use two limit comparisons, as in tad's followup, for
numerical ranges.  if your list is not numerical, or not contiguous, use a
grep:

my @range = (1..20);
my $number = 18;
if (grep /$number/, @range) {print "yes\n"} else {print "no\n"};

note the above wastes time on a large grep if @range is huge.

-- 
#!/usr/local/bin/perl -w
@"=(qw; P ;,q*e*,qq,r,,q;l;);$_=<<'/\<<$_; :-) \' ^/<\'<>/\'$!=0/\'/<&@_';
^[^a-i*#,k-z@&]u[s,*]t$ ^[]/$%a!&]*not*\(anything\)*here*$ ^p[$_r%,.]i*nt$
[^hi]?[]MOM!#]$ #  tfletche@pcocd2.intel.com  # ^h*[^b$d-j%/,l-z(]\{3\}er$
/\<<$_; :-) ' ^/<'<>/'$!=0/'/<&@_
for(split){map{s;print;join"",@";eg;chop;print}q& &.qx;look -r '$_';}# TMF



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

Date: Wed, 17 Sep 1997 14:23:06 -0600
From: tlowery@dsacng1.dsdc.dla.mil
To: jurlwin@access.digex.net
Subject: Re: Win NT and PERL HELP!!!!!!!
Message-Id: <874523379.30364@dejanews.com>

In article ,
  Rene Sorger  wrote:

For a more current port of perl (5.004_03) and instruction on how
to use with IIS or Personal Web  Win95 check out this page


http://www.access.digex.net/~jurlwin

>
> Orderpbs wrote:
> >
> > we are running IIS2.0 and NT and need to run Perl to be able to use
> > Formail and other cgi/perl scripts with web pages.
> >
> > Getting a NOT SUPPORTED error when the html page executes the script over
> > the web.
>
> Go to http://www.activestate.com and get Perl for Win32 and Perl for
> ISAPI, the last one is needed for your IIS2.0. There is also an FAQ
> where the installation is described.
>

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Wed, 17 Sep 1997 12:10:02 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Jeremy D. Zawodny" <jzawodn@wcnet.org>
Subject: Re: Win32 Perl FAQ Addition? (WAS Re: Is Perl for Win32 really as brain damaged as it seems?)
Message-Id: <Pine.GSO.3.96.970917120835.28240U-100000@julie.teleport.com>

On Wed, 17 Sep 1997, Jeremy D. Zawodny wrote:

> A Perl script *could* search the registry for all references to A:\
> (or B:\ for that matter) using some of the Win32::* modules. However,
> the hard part would be making sure the Perl script only nukes the
> unnecessary ones. :-)

Well, I was thinking of making it a command-line option whether to ask or
simply automatically to delete those refs. By default, it should nuke them
all, IMHO.

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 17 Sep 1997 19:19:48 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: Yknow, the thing about perl is....
Message-Id: <5vpagk$iq$1@news.fm.intel.com>

Randal Schwartz (merlyn@stonehenge.com) so eloquently and verbosely pontificated:
> >>>>> "Jason" == Jason Hazzard <hazzard@usa.net> writes:
> [snip]
> Jason> boil it down to about 50 lines!
> 
> Or show it to me, and I can probably get it down to 10 lines firing off
> three fewer processes. :-)

heck!  why not one line? :-)

% perl -e 'map {chomp;print} <>' <script.pl >oneline.pl

or Randal's favorite :-)

% cat script.pl | tr -d '\012' >oneline.pl

do i get an award for that one? :-)

-- 
#!/usr/local/bin/perl -w
print   "J"                      ."u".        #    -- Terry Fletcher
        "s"    ."t".    " A",     "n"         # tfletche@pcocd2.intel.com
   .    "o"   ,""."".   "the",    "r ","P".   #  Views expressed....not
   "e"."rl"   ." Ha",   "c",''    .""  ."".   #  INTeL's....yadda yadda
      ""            ,   "k".      "e"  ."r"  ;#          yadda....


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

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

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