Re: [Addendum] Stripping HTML from a text file.

2003-09-04 Thread drieux
On Wednesday, Sep 3, 2003, at 06:08 US/Pacific, Sara wrote: #!/usr/bin/perl use LWP::Simple; print "Content-type: text/html\n\n"; $url = 'http://yahoo.com'; $html = get($url); [snip] $html =~ s|.*?<\/head>||s; print "$html\n"; what you get from 'get' is a scalar $html that is the WHOLE PAGE

[Addendum] Stripping HTML from a text file.

2003-09-04 Thread Sara
Okay, when I finally implemented this, again its not working ... any ideas? simple regex like s///g; is working but not this one? #!/usr/bin/perl use LWP::Simple; print "Content-type: text/html\n\n"; $url = 'http://yahoo.com'; $html = get($u

Re: Stripping HTML from a text file.

2003-09-04 Thread drieux
On Thursday, Sep 4, 2003, at 17:55 US/Pacific, Hanson, Rob wrote: $text =~ s|().*?.*?.*?()|$1$2$3|s; actually that should be: $text =~ s|().*?(.*?).*?()|$1$2$3|s; way stylish! I actually like. But assumes that there will be a title element - otherwise it will fail and not clear out the other s

Re: Stripping HTML from a text file.

2003-09-04 Thread Wiggins d'Anconia
drieux wrote: It could just be my OCD, but if I could have hammered flat every FROOOTLOOP who wanted merely a 'quick and dirty' one time only fix, 'honest, it's just this one time', rather than actually cure the root cause problem, WE would be on a flat earth from all the pounding That or we

Re: Stripping HTML from a text file.

2003-09-04 Thread Sara
Thanks a lot Hanson, It worked for me. Yep, you are right "The regex way is good for quick and dirty HTML work." and especially for the newbies like me :)) Sara. - Original Message - From: "Hanson, Rob" <[EMAIL PROTECTED]> To: "'Wiggins d'Anconia'" <[EMAIL PROTECTED]>; "'Sara'" <[EMAI

Re: Stripping HTML from a text file.

2003-09-04 Thread drieux
On Thursday, Sep 4, 2003, at 17:55 US/Pacific, Hanson, Rob wrote: [..] I agree... but only if you are looking for a strong permanant solution. The regex way is good for quick and dirty HTML work. [..] technically we agree right up to the 'quick and dirty' part... I mean, how many times have we wa

RE: Stripping HTML from a text file.

2003-09-04 Thread Hanson, Rob
> Or maybe I misunderstood the question Or maybe I did :) > HTML::TokeParser::Simple I agree... but only if you are looking for a strong permanant solution. The regex way is good for quick and dirty HTML work. Sara, if you need to keep the tags, then you could use this modified version... #

Re: Stripping HTML from a text file.

2003-09-04 Thread drieux
On Wednesday, Sep 3, 2003, at 03:32 US/Pacific, Sara wrote: [..] What I want to do is to remove/delete HTML code from the text file from a certain tag upto certain tag. For example; I want to delete the code completely that comes in between and (including any style tags and embedded javascrip

Re: Stripping HTML from a text file.

2003-09-04 Thread Wiggins d'Anconia
Won't this remove *everything* between the given tags? Or maybe I misunderstood the question, I thought she wanted to remove the "code" from all of the contents between two tags? Because of the complexity and variety of HTML code, the number of different tags, etc. I would suggest using an HTML

RE: Stripping HTML from a text file.

2003-09-04 Thread Hanson, Rob
A simple regex will do the trick... # untested $text = "..."; $text =~ s|.*?||s; Or something more generic... # untested $tag = "head"; $text =~ s|<$tag[^>]*?>.*?||s; This second one also allows for possible attributes in the start tag. You may need more than this if the HTML isn't well formed

Stripping HTML from a text file.

2003-09-04 Thread Sara
I have a couple of text files with html code in them.. e.g. -- Text File -- This is Test File This is the test file contents blah blah blah. - What I want to do is to remove/delete HTML code from the text

Re: passing an argument to a subroutine

2003-09-04 Thread drieux
On Thursday, Sep 4, 2003, at 04:53 US/Pacific, Andrew Brosnan wrote: On 9/4/03 at 11:34 AM, [EMAIL PROTECTED] (B. Fongo) wrote: An argument passed to a subroutine returns wrong value. Code example: [..] In both cases, the script prints out 1. What is going on here? You are asking Perl for the numb

Desperately needs help with nested looping

2003-09-04 Thread B. Fongo
I'm quit confused with what I have below. I have 2 database tables; Games and groups. Name Group # John ,GroupA Miler, GroupA Peter, GroupB Mathew, GroupB Mark, GroupB Luke, GroupA I'm trying to select the members based on their groups and insert them into a different table

Re: passing an argument to a subroutine

2003-09-04 Thread Andrew Brosnan
On 9/4/03 at 11:34 AM, [EMAIL PROTECTED] (B. Fongo) wrote: > Hello > > An argument passed to a subroutine returns wrong value. > > Code example: > > @x = (1..5); > $x = @x; > > showValue ($x); # or showValue (\$x); > > > sub showValue { > > my $forwarded = @_; > print $forwarded

passing an argument to a subroutine

2003-09-04 Thread B. Fongo
Hello An argument passed to a subroutine returns wrong value. Code example: @x = (1..5); $x = @x; showValue ($x); # or showValue (\$x); sub showValue { my $forwarded = @_; print $forwarded; # print ${$forwarded}; } In both cases, the script prints out 1. What is going on here?