You can either iterate over directory entries using a loop, or read all the entries in the directory at once: while (my $file = readdir(Dir)) { print "$file\n" if $file! ~ /^\. /; } or my @files = grep {!
/^\. / } readdir Dir See perldoc -f readdir.
You can either iterate over directory entries using a loop, or read all the entries in the directory at once: while (my $file = readdir(Dir)) { print "$file\n" if $file! ~ /^\. /; } or my @files = grep {!
/^\. / } readdir Dir; See perldoc -f readdir.
That works fine and is much simpler. – acidblue Mar 24 at 18:59.
You're calling readdir() twice in a loop. Don't.
DOH! Thanks I didn't realize that was a no-no. – acidblue Mar 24 at 18:58 You are also calling grep in scalar context.
$file will just contain the number of matches from the grep call (i.e. , the number of files that don't match /^\. /) – mob Mar 24 at 19:04.
Or like so: #! /usr/bin/env perl -w use strict; opendir my $dh, '. '; print map {$_."\n"} grep {!
/^\. /} readdir($dh).
Use glob: my @files = glob( "$mydir/*" ); print "@files\n"; See perldoc -f glob for details.
While ($file = readdir(Dir)) { print "\n$file" if ( grep! /^\. /, $file ); } OR you can use a regualr expression : while ($file = readdir(Dir)) { print "\n$file" unless ( $file =~ /^\.
/ ); }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.