[17707] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5127 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 15 21:05:27 2000

Date: Fri, 15 Dec 2000 18:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976932308-v9-i5127@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 15 Dec 2000     Volume: 9 Number: 5127

Today's topics:
        (Beginner) Example CGI not working <garry@heaton6.freeserve.co.uk>
    Re: (Beginner) Example CGI not working <yf32@cornell.edu>
    Re: (Beginner) Example CGI not working <joe+usenet@sunstarsys.com>
    Re: (Beginner) Example CGI not working <garry@heaton6.freeserve.co.uk>
    Re: (Beginner) Example CGI not working <garry@heaton6.freeserve.co.uk>
    Re: basic code -- why won't it work??!! <sue@pennine.com>
        dynamically looding perl.modules <tomAtLinux@gma.at>
        FindBin <yf32@cornell.edu>
    Re: Function from string <dwb1@home.com>
    Re: Is a Hash of Arrays possible? <johngros@Spam.bigpond.net.au>
        Is Perl dying? <andrew_lee@earthlink.net>
    Re: Is Perl dying? <joe+usenet@sunstarsys.com>
        Need help on data processing tvn007@my-deja.com
    Re: One-Liner to Sum a Stack of Numbers? (Abigail)
    Re: One-Liner to Sum a Stack of Numbers? (Abigail)
    Re: One-Liner to Sum a Stack of Numbers? <tick.toff@spam.com>
    Re: Perl programming <johngros@Spam.bigpond.net.au>
    Re: perl scripts as exe's <johngros@Spam.bigpond.net.au>
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Christian Kaufhold)
        Pulling content from a HTML doc <someguyREMOVE@REMOVEsunflower.com>
    Re: Regular Expression Help <jdhunter@nitace.bsd.uchicago.edu>
    Re: Regular Expression Help <garry@heaton6.freeserve.co.uk>
    Re: Total Beginner <tick.toff@spam.com>
    Re: Total Beginner <tick.toff@spam.com>
    Re: Total Beginner (Randal L. Schwartz)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 16 Dec 2000 00:02:21 -0000
From: "Garry Heaton" <garry@heaton6.freeserve.co.uk>
Subject: (Beginner) Example CGI not working
Message-Id: <91ebe0$6jl$1@news6.svr.pol.co.uk>

I'm working with O'Reilly's "CGI Programming with Perl" and have just
typed-in the following example:

#!c:/perl/bin/perl.exe

print <<END_OF_HTML;
Content-type: text/html

<html>
<head>
<title>About This Server</title>
</head>
<body>
<h1>About This Server</hl>
<hr>
<pre>
 Server Name:   $ENV{SERVER_NAME}
 Listening on Port: $ENV{SERVER_PORT}
 Server Software:  $ENV{SERVER_SOFTWARE}
 Server Protocol:  $ENV{SERVER_PROTOCOL}
 CGI Version:   $ENV{GATEWAY_INTERFACE}
</pre>
<hr>
</body>
</html>
END_OF_HTML

When I load it onto Apache 1.3 / Win32 I can access the file in /cgi-bin but
receive the following error (from logs):

[Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Premature end of
script headers: c:/program files/apache group/apache/cgi-bin/httpex.pl
[Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Can't find string
terminator "END_OF_HTML" anywhere before EOF at c:/program files/apache
group/apache/cgi-bin/httpex.pl line 3.

I've re-checked the typing but it seems to be exactly as in the book. What
to do?

Garry Heaton




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

Date: Fri, 15 Dec 2000 19:55:13 -0500
From: Young Chi-Yeung Fan <yf32@cornell.edu>
Subject: Re: (Beginner) Example CGI not working
Message-Id: <3A3ABD71.B7D6B09@cornell.edu>

Garry Heaton wrote:

> I'm working with O'Reilly's "CGI Programming with Perl" and have just
> typed-in the following example:
>
> #!c:/perl/bin/perl.exe
>
> print <<END_OF_HTML;
> Content-type: text/html
>
> <html>
> <head>
> <title>About This Server</title>
> </head>
> <body>
> <h1>About This Server</hl>
> <hr>
> <pre>
>  Server Name:   $ENV{SERVER_NAME}
>  Listening on Port: $ENV{SERVER_PORT}
>  Server Software:  $ENV{SERVER_SOFTWARE}
>  Server Protocol:  $ENV{SERVER_PROTOCOL}
>  CGI Version:   $ENV{GATEWAY_INTERFACE}
> </pre>
> <hr>
> </body>
> </html>
> END_OF_HTML
>
> When I load it onto Apache 1.3 / Win32 I can access the file in /cgi-bin but
> receive the following error (from logs):
>
> [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Premature end of
> script headers: c:/program files/apache group/apache/cgi-bin/httpex.pl
> [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Can't find string
> terminator "END_OF_HTML" anywhere before EOF at c:/program files/apache
> group/apache/cgi-bin/httpex.pl line 3.
>
> I've re-checked the typing but it seems to be exactly as in the book. What
> to do?
>
> Garry Heaton

Be sure to press Enter/Return right after you type END_OF_HTML (at the bottom).
If you finish the file on that line rather than ending that line with a newline,
it won't work.



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

Date: 15 Dec 2000 20:03:31 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: (Beginner) Example CGI not working
Message-Id: <m3itoltbx8.fsf@mumonkan.sunstarsys.com>

"Garry Heaton" <garry@heaton6.freeserve.co.uk> writes:

> I'm working with O'Reilly's "CGI Programming with Perl" and have just
> typed-in the following example:
> 
[...]
> END_OF_HTML

> [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Premature end of
> script headers: c:/program files/apache group/apache/cgi-bin/httpex.pl
> [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Can't find string
> terminator "END_OF_HTML" anywhere before EOF at c:/program files/apache
> group/apache/cgi-bin/httpex.pl line 3.

Works fine for me - you might have a line-terminator problem 
on your last line of code.  Try editing the file on the server 
and retyping it:

END_OF_HTML

(no spaces after END_OF_HTML, and be sure you hit the return 
key.)

If you can't edit it on the server, edit your local copy and 
be sure you upload it as an ASCII text file (so line terminators 
will translate right).

HTH
-- 
Joe Schaefer


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

Date: Sat, 16 Dec 2000 01:09:17 -0000
From: "Garry Heaton" <garry@heaton6.freeserve.co.uk>
Subject: Re: (Beginner) Example CGI not working
Message-Id: <91efbc$svs$1@newsg2.svr.pol.co.uk>

Young, you're a star. I owe you one! Missed <RETURN>. Live and learn.

Thanks again

Garry


"Young Chi-Yeung Fan" <yf32@cornell.edu> wrote in message
news:3A3ABD71.B7D6B09@cornell.edu...
> Garry Heaton wrote:
>
> > I'm working with O'Reilly's "CGI Programming with Perl" and have just
> > typed-in the following example:
> >
> > #!c:/perl/bin/perl.exe
> >
> > print <<END_OF_HTML;
> > Content-type: text/html
> >
> > <html>
> > <head>
> > <title>About This Server</title>
> > </head>
> > <body>
> > <h1>About This Server</hl>
> > <hr>
> > <pre>
> >  Server Name:   $ENV{SERVER_NAME}
> >  Listening on Port: $ENV{SERVER_PORT}
> >  Server Software:  $ENV{SERVER_SOFTWARE}
> >  Server Protocol:  $ENV{SERVER_PROTOCOL}
> >  CGI Version:   $ENV{GATEWAY_INTERFACE}
> > </pre>
> > <hr>
> > </body>
> > </html>
> > END_OF_HTML
> >
> > When I load it onto Apache 1.3 / Win32 I can access the file in /cgi-bin
but
> > receive the following error (from logs):
> >
> > [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Premature end of
> > script headers: c:/program files/apache group/apache/cgi-bin/httpex.pl
> > [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Can't find string
> > terminator "END_OF_HTML" anywhere before EOF at c:/program files/apache
> > group/apache/cgi-bin/httpex.pl line 3.
> >
> > I've re-checked the typing but it seems to be exactly as in the book.
What
> > to do?
> >
> > Garry Heaton
>
> Be sure to press Enter/Return right after you type END_OF_HTML (at the
bottom).
> If you finish the file on that line rather than ending that line with a
newline,
> it won't work.
>




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

Date: Sat, 16 Dec 2000 01:12:37 -0000
From: "Garry Heaton" <garry@heaton6.freeserve.co.uk>
Subject: Re: (Beginner) Example CGI not working
Message-Id: <91efhk$jdk$1@newsg3.svr.pol.co.uk>

Sorry Joe, you also deserve credit. Yes, I missed the invisible return and I
also remember reading about it under "Here Documents" in the Camel the other
day. Now I can go to bed (01.11 London time)

Best wishes

Garry


"Joe Schaefer" <joe+usenet@sunstarsys.com> wrote in message
news:m3itoltbx8.fsf@mumonkan.sunstarsys.com...
> "Garry Heaton" <garry@heaton6.freeserve.co.uk> writes:
>
> > I'm working with O'Reilly's "CGI Programming with Perl" and have just
> > typed-in the following example:
> >
> [...]
> > END_OF_HTML
>
> > [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Premature end of
> > script headers: c:/program files/apache group/apache/cgi-bin/httpex.pl
> > [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Can't find string
> > terminator "END_OF_HTML" anywhere before EOF at c:/program files/apache
> > group/apache/cgi-bin/httpex.pl line 3.
>
> Works fine for me - you might have a line-terminator problem
> on your last line of code.  Try editing the file on the server
> and retyping it:
>
> END_OF_HTML
>
> (no spaces after END_OF_HTML, and be sure you hit the return
> key.)
>
> If you can't edit it on the server, edit your local copy and
> be sure you upload it as an ASCII text file (so line terminators
> will translate right).
>
> HTH
> --
> Joe Schaefer




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

Date: 15 Dec 2000 14:27:04 -0800
From: Sue Spence <sue@pennine.com>
Subject: Re: basic code -- why won't it work??!!
Message-Id: <91e5ro0305n@drn.newsguy.com>

In article <3a3a5e2d_5@goliath2.newsfeeds.com>, "John says...
>
>Huh. Absolute most bizarre thing I've seen this week.
>
>Thanks for the help, John. I wondered whether I was going crazy.
>
>Your post did lead to a solution, though not one I'm entirely satisfied
>with. I tried similar code using a new file, and it worked.
>
>I tried modifying the previous code to be virtually identical to the new
>file, and -- it DIDN'T work.
>
>Nothing I could discover wrong with the file. Maybe there was a wierd,
>invisible character in there somewhere, but that's about the only thing I
>can think of. Permissions were all the same, everything.
>
>Now here's another thought. A unix question, more. I wonder whether...
>
>BINGO! I think I found it.
>
>I renamed file2 to file1. It no longer works.
>
>Appears Unix is executing some other file, somewhere else, by the same name
>as file1. No visible output.

Do a 'which file1', unless 'file1' == 'test', in which case do a 'man test', and
never call anything else 'test'.  ;-)

One further suggestion - put your current directory ('.') in your path ahead of
everything else.



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

Date: Fri, 15 Dec 2000 21:30:54 +0100
From: Thomas Schindl <tomAtLinux@gma.at>
Subject: dynamically looding perl.modules
Message-Id: <3A3A7F7E.2060301@gma.at>

Hy newsgroup,

does anybody know how I can load perl-modules at run time? I know that 
the following example won't work it should only illustrate my problem.

--------------cut---------------
my @perlArray=(
         "module1",
         "module2"
            );

if($status == 1)
{
    use $perlArray[0];
}
else
{
    use $perlArray[1];
}

--------------cut----------------

Is loading perl-modules at runtime possible? Can anybody help me?

Thanks

Tom



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

Date: Fri, 15 Dec 2000 18:37:04 -0500
From: Young Chi-Yeung Fan <yf32@cornell.edu>
Subject: FindBin
Message-Id: <3A3AAB20.3BACEED8@cornell.edu>

Just installed ActivePerl 622 (5.6) and see that there is no FindBin,
but there was in version 5. What happened to it? Is this unique to
ActivePerl, or Perl in general? What do I use since I don't have
FindBin?

Thanks.



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

Date: Sat, 16 Dec 2000 01:37:09 GMT
From: "Daniel W. Burke" <dwb1@home.com>
Subject: Re: Function from string
Message-Id: <Pine.LNX.4.20.0012152040430.6188-100000@ethyl.addictmud.org>

On 15 Dec 2000 nobull@mail.com wrote:

> "Daniel W. Burke" <dwb1@home.com> writes:
> 
> > %CUSTOM_FUNCTION = (
> >   "NEW_AND_UPDATED","GetNewAndUpdated",
> > 
> > my $CustomFunction = $CUSTOM_FUNCTION{$in{'REPORT_TYPE'}};
> > &$CustomFunction;
> 
> Real solution: replace symbolic refs by real refs.
> 
>  %CUSTOM_FUNCTION = (
>    "NEW_AND_UPDATED",\&GetNewAndUpdated,
>    "AVG_TO_CLOSURE",\&GetAvgToCLosure,
>    "AGENT_ACTIVITY",\&GetAgentActivity,
> 

That's perfect!  Thanks!

Dan.



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

Date: Sat, 16 Dec 2000 02:03:52 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Is a Hash of Arrays possible?
Message-Id: <c4A_5.19782$xW4.156745@news-server.bigpond.net.au>

I thought perllol was just perl jokes!?!?
"Tom Christiansen" <tchrist@perl.com> wrote in message
news:3a3a42e1$1@cs.colorado.edu...
> In article <3a39e95c@news-uk.onetel.net.uk>, Edd <edd@texscene.com> wrote:
> What part of the perlref, perldsc, or perllol manpages was it
> that you didn't understand? :-(
>
> --tom




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

Date: Sat, 16 Dec 2000 00:59:21 GMT
From: Andrew Lee <andrew_lee@earthlink.net>
Subject: Is Perl dying?
Message-Id: <3A3ABE95.56F9550E@earthlink.net>

No, not the language.

Are there less jobs for Perl developers as the dot com economy goes
belly up?

Or, could it be that a critical mass of project managers won't use Perl
because (it seems) no two programmers write Perl the same way?  Thus,
languages like Python or Java are more favorable for team development of
reusable code ...

Just wondering.  (pleading for a world-wide minimum proficiency & coding
standard for Perl)







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

Date: 15 Dec 2000 20:47:56 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Is Perl dying?
Message-Id: <m3elz9t9v7.fsf@mumonkan.sunstarsys.com>

Andrew Lee <andrew_lee@earthlink.net> writes:

> No, not the language.
> 
> Are there less jobs for Perl developers as the dot 
> com economy goes belly up?

It's not going belly up- it's just the ebb following the 
multi-trillion-dollar millennial makework created by 
short-sighted programming, not a programming language.  
It's now finally appropriate to sack the responsible
parties :)

> Or, could it be that a critical mass of project managers 
> won't use Perl because (it seems) no two programmers write 
> Perl the same way?  Thus, languages like Python or Java are 
> more favorable for team development of reusable code ...

Perl is written by programmers, for programmers.  How such an 
inherently utilitaritian endeavor could be construed as unfit 
for serious projects is beyond me.  If something sucks in 
perl(+CPAN), it goes the way of the dodo.  That's not like many 
other languages I'm familiar with, where "appropriate" code 
libraries are sanctioned by the illuminati who decide what's 
best for the rest of us.

> Just wondering.  (pleading for a world-wide minimum 
> proficiency & coding standard for Perl)

Why?  Perl allows beginning programmers to accomplish 
tremendous things without having a clue as to what goes 
on behind the scenes.  I'd rather see a minimum proficiency 
at reading and writing standardized documentation than 
checking for a certified jaPh badge. 

A person that values encapsulation and understands the 
importance of a fixed API will eventually figure out how 
to implement it well in virtually any language. With 
perl(+CPAN), the time it takes to come up with a 
satisfactory implementation is usually quite short.

-- 
Joe Schaefer


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

Date: Sat, 16 Dec 2000 01:39:02 GMT
From: tvn007@my-deja.com
Subject: Need help on data processing
Message-Id: <91eh3m$vt7$1@nnrp1.deja.com>

Hi,

If I have  lines as shown below:

(:op ( rep 25 )
sp_R ab cd 1001 )

How can I convert to a single line like this:

R25 sp_R ab cd 1001 ;


Sent via Deja.com
http://www.deja.com/


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

Date: 16 Dec 2000 00:48:36 GMT
From: abigail@foad.org (Abigail)
Subject: Re: One-Liner to Sum a Stack of Numbers?
Message-Id: <slrn93lev4.qo9.abigail@tsathoggua.rlyeh.net>

On 15 Dec 2000 20:36:59 GMT, revjack (revjack@revjack.net) wrote in comp.lang.perl.misc <URL: news:<91dvdb$pq3$1@news1.Radix.Net>>:
++ More and more I find myself having to take a stream of
++ numbers that comes from some process, like: 
++ 
++ 1192
++ 2
++ 44039
++ 334
++ 22
++ 0
++ 3384
++ 
++ ...and simply determine the sum of them. I have been doing
++ it like this: 
++ 
++ 
++ (process) | perl -wle 'while(<>){$x+=$_}print $x'
++ 
++ Is there a better|smarter|faster|more elegant way to produce
++ the sum of such output?


Any one with a classical Unix background knows the AWK solution:

    (process) | awk '{s += $1} END {print s}'

From there, the step to Perl is trivial:

    (process) | perl -nle '$s += $1; END {print $s}'



Abigail


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

Date: 16 Dec 2000 00:51:09 GMT
From: abigail@foad.org (Abigail)
Subject: Re: One-Liner to Sum a Stack of Numbers?
Message-Id: <slrn93lf3t.qo9.abigail@tsathoggua.rlyeh.net>

On 16 Dec 2000 00:48:36 GMT, Abigail (abigail@foad.org) wrote in comp.lang.perl.misc <URL: news:<slrn93lev4.qo9.abigail@tsathoggua.rlyeh.net>>:
++ 
++ From there, the step to Perl is trivial:
++ 
++     (process) | perl -nle '$s += $1; END {print $s}'

Duh!

Read that as:
       (process) | perl -nle '$s += $_; END {print $s}'



Abigail


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

Date: Sat, 16 Dec 2000 01:20:06 GMT
From: "SuperGumby" <tick.toff@spam.com>
Subject: Re: One-Liner to Sum a Stack of Numbers?
Message-Id: <arz_5.19724$xW4.156568@news-server.bigpond.net.au>

OK OK, having just commented in another post on the proliferation of
oneliners,,, How can this be described as a oneliner ? Theoretically it
seems to me any perl program can be written sans <cr> but this thing has a
'statement terminator' in the middle of it.

Abigail wrote in message ...
>On 16 Dec 2000 00:48:36 GMT, Abigail (abigail@foad.org) wrote in
comp.lang.perl.misc <URL:
news:<slrn93lev4.qo9.abigail@tsathoggua.rlyeh.net>>:
>++
>++ From there, the step to Perl is trivial:
>++
>++     (process) | perl -nle '$s += $1; END {print $s}'
>
>Duh!
>
>Read that as:
>       (process) | perl -nle '$s += $_; END {print $s}'
>
>
>
>Abigail




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

Date: Sat, 16 Dec 2000 01:59:48 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Perl programming
Message-Id: <o0A_5.19772$xW4.156253@news-server.bigpond.net.au>

You might like to try a batch file  that contains:
perl -w working.pl
Name it run.bat
Then when you want to see how your script runs just type run. When it is
finished save as your scripts destination address and name.

"Anuj" <anujm2000@hotmail.com> wrote in message
news:t3jlkdmaeoku6a@corp.supernews.com...
> Hello,
>    I am a beginner in perl programming.I work on win98.  I have downloaded
> the perl interpertor from www.activestate.com & installed it in c:\perl.
> The main perl.exe file path is C:\perl\bin\perl.exe . I write a perl file
> (.pl) in a program which i downloaded called perl scripting tool. I know
> that to run scripts i need the .pl file to be reffered to the perl
> interpreter. In the DOS prompt i have to write "PATH=/perl/bin" always
> before running the script and then writing the initializing command
> i.e "perl hello.pl" ( An example file hello.pl) . Is there a way that i
> dont need to always write the PATH=/perl/bin command so that i can
> directly run the scripts from the DOS prompt by typing "perl hello.pl". If
> so please reply me.Can you please tell me some web sites realted to perl
> that provide information for beginners?
> Thank You
> Anuj
>
> --
> Posted via CNET Help.com
> http://www.help.com/




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

Date: Sat, 16 Dec 2000 01:53:42 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: perl scripts as exe's
Message-Id: <GWz_5.19764$xW4.156511@news-server.bigpond.net.au>

Thanks Arek that seems better than what I was reading.
"Arek P" <Arek@nospam._pietruszewski_.com> wrote in message
news:91deu1$2foi$1@earth.superlink.net...
> Use perl2exe  http://www.indigostar.com/ (my choice) or if You have
> Perl Dev Kit, thats another alternative.
>
> ArekP





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

Date: Sat, 16 Dec 2000 01:10:28 +0100
From: ch-kaufhold@gmx.de (Christian Kaufhold)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <91ebnl$ai4$4@news.rz.uni-karlsruhe.de>

Christian Kaufhold <ch-kaufhold@gmx.de> wrote:
> Bart Lateur <bart.lateur@skynet.be> wrote:
[...]

>> It looks remarkably much like the mail I got when I first posted to
>> comp.lang.perl.misc with a new e-mail address. It got sent to every new
>> poster (with an unmunged e-mail address -- duh!). Doesn't this happen
>> any more?


> I never got it. But I think I only posted replies.

This time I got it.


Christian


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

Date: Fri, 15 Dec 2000 18:05:01 -0600
From: "Hawk" <someguyREMOVE@REMOVEsunflower.com>
Subject: Pulling content from a HTML doc
Message-Id: <t3lcfprf2inbf6@corp.supernews.com>

Hello,

    This is probably simple but it has me stumped. What Id like to do is
take a HTML document (one thats on my server, not another website) and
insert comments in it. like :

<!--CONTENT-->
Content to be retrieved here
<!--CONTENT-->

And then have the script grab everything between the two <!--CONTENT-->
lines. Can someone post a little sample of code that would be able to do
this?

Thanks in advance!




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

Date: 15 Dec 2000 17:18:29 -0600
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: Regular Expression Help
Message-Id: <1ru285tgsa.fsf@video.bsd.uchicago.edu>

>>>>> "Jonathan" == Jonathan Swartz <jswartz@sentiat.com> writes:

    Jonathan> I need to pull just the value from the href property
    Jonathan> out.  For some reason, my expression bombs when a tag is
    Jonathan> nested inside of the link.  My expression is as
    Jonathan> follows...

I now this isn't what you asked, but have you considered using the
HTML::LinkExtor module for this.  This is what it does best!  If you
are dead set on the regexp, look through the HTML::Parser code for the
industrial strength version.

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

use HTML::LinkExtor;
use strict;
my $htmlfile = shift || die "You must supply a filename\n";
my $parser = HTML::LinkExtor->new();
$parser->parse_file($htmlfile);

foreach my $linkarray ($parser->links) {
  my @element = @$linkarray;
  print "$element[2]\n";
}





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

Date: Sat, 16 Dec 2000 01:32:07 -0000
From: "Garry Heaton" <garry@heaton6.freeserve.co.uk>
Subject: Re: Regular Expression Help
Message-Id: <91egm5$k8n$1@newsg3.svr.pol.co.uk>

I'm new at this game but here goes:

/<a href\s*=\s*['"]([^'"]+)['"]/

Then access the parenthesised subexpression with $1

Might be a load of rubbish.

Garry Heaton


"Jonathan Swartz" <jswartz@sentiat.com> wrote in message
news:rqx_5.10811$h67.709356@newsread1.prod.itd.earthlink.net...
> Hey all,
>
> I'm having some problems with a regular expression that I am attempting to
> write.  The problem seems simple, and I'm sure I'm just overlooking
> something.
>
> Given a link like such..
> <a name='lnkTest' href='http://www.mysite.com/' class='link'><font
> color='#990000'>Test Link</font></a>
>
> I need to pull just the value from the href property out.  For some
reason,
> my expression bombs when a tag is nested inside of the link.  My
expression
> is as follows...
>
> \s*<a.*\bhref=(.+)>[< ].+
>
> Any help would be greatly appreciated!
>
> Thanks,
> Jonathan
> jswartz@sentiat.com
>
>




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

Date: Sat, 16 Dec 2000 00:20:30 GMT
From: "SuperGumby" <tick.toff@spam.com>
Subject: Re: Total Beginner
Message-Id: <izy_5.19676$xW4.156027@news-server.bigpond.net.au>

I'm finding this useful

http://wdvl.internet.com/Authoring/Languages/Perl/PerlfortheWeb/toc.html

I haven't done more than skim this

http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html

some stuff

http://www.ncsa.uiuc.edu/General/Training/PerlIntro/
http://www.netcat.co.uk/rob/perl/win32perltut.html

whoops, almost forgot

http://www.perl.com/pub/2000/10/begperl1.html



Sandra Pearce wrote in message <91dpkd$d61$1@newsg2.svr.pol.co.uk>...
>Hi,
>
>Any good sites for a total beginner to perl....
>I want to create some CGI scripts.
>
>
>




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

Date: Sat, 16 Dec 2000 00:26:16 GMT
From: "SuperGumby" <tick.toff@spam.com>
Subject: Re: Total Beginner
Message-Id: <IEy_5.19679$xW4.155830@news-server.bigpond.net.au>

OH, and reading this group daily (if only it wasn't quite so busy).

PS Why does it appear perl programmers are so damned obsessed with
oneliners, I'm feeling as if I'm gonna be ostracised for commenting and
structuring,,, maybe I'll know why in a few months :-)




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

Date: 15 Dec 2000 17:05:45 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Total Beginner
Message-Id: <m1k891gopi.fsf@halfdome.holdit.com>

>>>>> "SuperGumby" == SuperGumby  <tick.toff@spam.com> writes:

SuperGumby> OH, and reading this group daily (if only it wasn't quite so busy).
SuperGumby> PS Why does it appear perl programmers are so damned obsessed with
SuperGumby> oneliners, I'm feeling as if I'm gonna be ostracised for commenting and
SuperGumby> structuring,,, maybe I'll know why in a few months :-)

Because Perl's so durn easy to use we got time to play around impressing
each other. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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


------------------------------
End of Perl-Users Digest V9 Issue 5127
**************************************


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