2.10.2010, 13:57:54, "jobst müller" wrote:
> #!/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' );
->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;
my @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 #
--
Regards,
Alex
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/