[ . . ]
Hi,
my @new = grep /[^.]/, readdir DIR;
(on Linux I tried it) that eliminates . and .. from the catch.
*But the next code prints all 8 lines of data it does not eliminate . and ..
from the catch, print*
Isn't that a character class that says "not a dot"
So, why the difference (readdir line above versus the next code)? Is it a
difference of list context (the grep) versus scalar context (ea. line of DATA
is a string) ???
#!/usr/bin/perl
use strict;
use warnings;
while ( <DATA> ) {
print if /[^.]/;
#print "$_\n" if grep /[^.]/, $_;
#print unless /\./;
#print if /star/;
}
__DATA__
star.txt
things
.dotfile
aft
.
..
filename.htm
stuff
# code ended on previous line
--
Alan.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>