Bill that is absolutely great it works a treat I have learnt a lot. I will spend some time studying and hopefully progress a little more. Thank you again.
Malcolm ----- Original Message ----- From: "$Bill Luebkert" <[EMAIL PROTECTED]> To: "Malcolm Debono" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, February 15, 2003 2:39 AM Subject: Re: help reading file url & loop > Malcolm Debono wrote: > > okay, because of your help I think I am beginning to get some of this. > > > > Question.....How do I write this, > > $links{$url} = ''; > > if ($content =~ /<title[^>]*>\s*(.*)\s*<\/title>/i) { > > $links{$url} = $1; > > } > > if ($content =~ /<form[^>]*>\s*(.*)\s*<\/form>/i) { > > $links{$url} = $2; > > This is going to by $1 also since there is only set of parens > capturing in the RE. If you want to save the whole form, you > need to either add a hash like %forms: $forms{$url} = $1; > or you could restructure the orig hash to have two fields > for each url (hash of hashes or hash of arrays). > > Also if there are multiple newlines in your form or title, you > may need to add the 'treat as single line' qualifier 's' to > your RE: > > if ($content =~ /<form[^>]*>\s*(.*)\s*<\/form>/is) { > ^ here > > > > } > > > > so that it writes here........ > > > > foreach my $url (keys %links) { > > > > print OUT "$url\n"; > > print OUT "$links{$url}\n"; > > print OUT "------------------\n"; > > print "<BR><BR><B>URL: $url</B>\n"; > > print "<BR><B>Title: "; > > if ($links{$url}) { > > print "$links{$url}"; > > Print the form (not sure you would want to do this without > stripping the tags out: > > if (exists $forms{$url}) { > print $forms{$url}, "\n"; > } > > > Please bare with me I am trying to do this on my computer before asking. > > > > All your help is greatly appreciated. > > > -- > ,-/- __ _ _ $Bill Luebkert ICQ=162126130 > (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] > / ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl) > -/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/ > > > _______________________________________________ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs