At 1:29 AM +0200 10/2/10, jobst müller wrote:
Hi all

i am new to the list!

i am new to Linux and new to PERL too. I am trying to get this perl script up and running. I have installed OpenSuse-Linux 11.3

What is wanted: I have a bunch of HTML-files, stored in a folder. with the Perl-Script (see below) i want to parse the HTML-files.

I have stored the script to the following place:

Basisordner (german word for base folder) > user > perl >
My question is - how to name the paths ...

a. to the html-folder that contains the HTML-files that need to be parsed (i named this folder html.files)

The path to the top-level directory of the directory tree containing the HTML files should be placed as the argument to the in() method of File::Find::Rule.

b. how to name the file that has to be created...

I can't help you here, as I do not know what file you want to create.



here the code

Your program will not compile, as you have commented out the definition of $file.

#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use HTML::TokeParser;

# my $file = 'school.html';

my @html_files = File::Find::Rule->file->name( '*.html.files' )->in( $
+html_dir );

What is the plus sign doing here? Do you mean the variable $htmo_dir. That will work if $html_dir contains the path (absolute or relative) of the top-level directory to search for HTML files.

Are the HTML files named as '*.html.files'? More likely is '*.html', in which case that is what should be the argument to the name() method. Sometimes, HTML files end with just 'htm', in which case ''*.html?' (making the 'l' optional) might work for you.

You seen to be having a problem with the File::Find::Rule module. I suggest you write a shorter, simpler program that finds all of the HTML files and prints their names. After you get that working, you can add reading and parsing the files. You will need to add 'use File::Find::Rule;' to your program.

print qq/$school{'name'}n/;

You should have \n instead of just n: Parentheses will avoid your qq argument looking like a regular expression:

print qq($school{'name'}\n);

--
Jim Gibson
j...@gibson.org

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to