Need help writing perl script (easy)? - invocation sample birthday
I have to write a program that every file and directory names in the specified directory
Thus, a sample of invoking a Perl script is PSCRIPT
PSCRIPT / usr / local
And that the file / directory names in / usr / local
Wednesday, January 27, 2010
Invocation Sample Birthday Need Help Writing Perl Script (easy)?
Subscribe to:
Post Comments (Atom)
3 comments:
Here you go.
not necessarily all the arguments and the recursion apart from the top level directory and not regular expressions to control the boards., .. and no less
but it must be your work, now that I have shown the way
#! / Usr / bin / perl-w
print "directory: $ ARGV [0] \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ n";
dirtoget $ = $ ARGV [0];
opendir (DIR, $ dirtoget) | | die ( "Can not open file \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ n");
Thefile = @ readdir (DIR);
closedir (DIR);
foreach $ fd (@ thefile)
(
unless (($ fd eq ".") | | ($ fd eq ".."))
(
print "$ fd \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ n";
)
)
I do not write an entire program for you, but here are some pointers.
Change of use "for the argument.
Opendir use "to start reading the list.
Readdir use "to read the texts in the directory.
With pressure "top names.
Ok ... What is your opinion? As there is no problem. What you are experiencing problems with specifically?
Post a Comment