hello Jim, hello list! here i am back again!
many thanks for the quick reply. My question is regarding the I-O handle. I have to find the right path names. Names and conventions that match the linux conventions...i took your example and made some slight corrections... Note: i run OpenSuse Linux 11.3 - and i put the files to home/user/ there i put the following in: a. the script - perl_script_two.pl and b. perl_script_three.pl - in oder to test the two variations. AND i also put in here the directory with the HTML-files. I named this Html.files - which might be not so clever... See all the results - with other scripts - of course... Jim, i took your hints and made some smaller scripts that try to find the htmlfiles: the first: perl_script_two: #!/usr/bin/perl use strict; use warnings; use diagnostics; use File::Find::Rule; my @files = File::Find::Rule->file() ->name('*.html') ->in( 'home/usr/perl/html.files' ); foreach my $file(@files) { print $file, "\n"; } response: suse-linux:/usr/perl # perl perl_script_two.pl Can't stat home/usr/html.files: No such file or directory at /usr/lib/perl5/site_perl/5.12.1/File/Find/Rule.pm line 594 suse-linux:/usr/perl # and perl_script_three #!/usr/bin/perl use strict; use warnings; use diagnostics; use File::Find::Rule; my $HOME ="home/usr/perl/html.files"; opendir (THISDIR, $HOME) or warn "Could not open the dir ".$HOME.": $!"; @allfiles = grep !/^\.\.?$/, readdir THISDIR; closedir THISDIR; response: suse-linux:/usr/perl # perl perl_script_three.pl Global symbol "@allfiles" requires explicit package name at perl_script_three.pl line 10. Execution of perl_script_three.pl aborted due to compilation errors (#1) (F) You've said "use strict" or "use strict vars", which indicates that all variables must either be lexically scoped (using "my" or "state"), declared beforehand using "our", or explicitly qualified to say which package the global variable is in (using "::"). Uncaught exception from user code: Global symbol "@allfiles" requires explicit package name at perl_script_three.pl line 10. Execution of perl_script_three.pl aborted due to compilation errors. at perl_script_three.pl line 12 suse-linux:/usr/perl # love to hear from you and appreciate any and all help! martin aka floobee -----Ursprüngliche Nachricht----- Von: "Jim Gibson" <jimsgib...@gmail.com> Gesendet: 02.10.2010 02:44:54 An: beginners@perl.org Betreff: Re: path names in a perl-script: a newbie-question >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/ > > ___________________________________________________________ Neu: WEB.DE De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: https://produkte.web.de/go/demail02 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/