I use readdir to get the files of a directory , but I want to remove . and .. using grep . The output shows it still contain the . and .. , but I can't figure out what's wrong with it ?
here is my code
#!/usr/bin/perl
opendir(Dir,$ARGV[0]);
@Dirs = readdir(Dir);
@Dirs = grep { $_ != /./ } @Dirs;
# @Dirs = grep { $_ =~ /^./ } @Dirs;
print join("\n",@Dirs);
Thanks