[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ProgSoc] Perl not-grep



In perl, I want to get a list of files/dirs in a directory.

The readdir() function returns this including '.' and '..'. I don't want 
these, so I thought I would remove them using grep.

It's easy to match the '.' and '..' using the regular expression /^\./ 
(this just matches anything starting with a dot '.' which is sufficient 
for my purpose)

The statement which selects files starting with dot is:

@nospam.camDirNames = grep {/^\./} readdir($serverDir);

However, this returns the rows I want to discard. How do I return the 
other rows, ie the rows that would normally be discarded?

Cheers,
Jay.

-- 
--
Jay Banyer
Computer Systems Operator
James Cook University, Townsville
(07) 4781 6395


-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.