develooper Front page | perl.beginners | Postings from July 2022

Re: How to can develop a program

Thread Next
July 21, 2022 01:04
Re: How to can develop a program
Message ID:

I'm going to be traveling, so will not be able to help much
in the next 2 days.

That is a PDF file you supplied.  Is it fair to say you want to
be able to search for all the names listed in a text file and be
able to print out which file contains which name.  And in some
cases the name will not be in any of the files?  Is that the goal?

Define your goal and we will help you.

The file below is a bit old, but maybe it works for your
PDF files.  I have not tested it on your url.  I gather
you don't have HTML tables, so maybe it is not for your case.


#!/usr/bin/perl -w
# This program writes the results of the webpage listed in line 17
# to $outfile.  So basically it converts HTML to text.
# It works reasonably well with HTML tables.

use strict;
use warnings;
use LWP::UserAgent;
use HTML::FormatText::WithLinks::AndTables;

my $page = '';

my $outfile = 'output.txt';

chdir '/home/mike/Documents/copy';

open OUT, ">>$outfile" or die "Can't open '$outfile': $!";

my ($sl, $request, $response, $html);

$sl = LWP::UserAgent->new;

$sl->proxy('http', ''); # enter proxy if needs be / and set it for Soap 
too ...
$request = HTTP::Request->new('GET', $page);
$response = $sl->request($request);
$html = $response->as_string;

print "Got it into \$html.\n";

my $text = HTML::FormatText::WithLinks::AndTables->convert($html);

print OUT "$text";

print "\nAll done.\n";

close OUT;


On 7/20/22 10:13, William Torrez Corea wrote:
> The url of the page:
> On 7/20/22, William Torrez Corea <> wrote:
>> Exist a page where you put info about the person but if you want to search
>> a name you must search this manually. So, I want to automate this process
>> with perl.
>> --
>> With kindest regards, William.
>> ⢀⣴⠾⠻⢶⣦⠀
>> ⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
>> ⢿⡄⠘⠷⠚⠋⠀
>> ⠈⠳⣄⠀⠀⠀⠀

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About