I. file input/output functions
1. Basic I/O functions
Open: Allow programs to access files
Close: Terminate File Access
Print: file write string
Write: Write the formatting information to the file.
Printf: format the string and output it to the
Often encounter downloaded files or e-books, the name contains a number of web site information, the actual use because the name is too long inconvenient, the following script uses regular expressions to rename all the files under the directory:For
The Perl script batchreplace.pl can be used to bulk replace the text/code in the file. You can find files of the specified type in the specified directory and recursively check subdirectories, and copy the directory structure of the input file when
The Perl script batchReplace. pl can be used to replace text/code in files in batches. You can search for files of the specified type in the specified directory and recursively check the subdirectories. Copy the directory structure of the input file
In Perl, The chdir function is used to change the current working directory to the specified directory. If no directory is specified, it goes to the user's main directory. This function calls the CD command in UNIX to switch directories. Here is a
Environment for WinDOS, two points to note:
1, the default ActivePerl under the code is GBK, so you need to convert the string to GBK will not display garbled2, to traverse the file directory, you need to exclude a special directory.
Complete code:
#!/usr/bin/perl-w UseStrict; UseFile::Spec;Local$\ ="\ n";#each line of output of the current module adds a newline charactermy %options;#directory path$options{Single_case} ='/home/jiangyu/src/pl/example'; my @cases; if(-D$options{single_case})
#!/usr/bin/perl-w use
strict;
Use File::spec;
Local $\ = "\ n"; #当前模块的每行输出加入换行符 my
%options;
#目录路径
$options {single_case} = '/home/jiangyu/src/pl/example ';
my @cases;
if (-D $options {single_case}) {#判断目录是否存在 my
@files;
my $dh;
Server-side scripting technology is a very useful thing, combining it with client script technology to create a very powerful page. It seems like a long time ago, which version (appears to be the WWW edition) discussed ASP to the point of full swing,
Ordinary PHP Programmer pen TestTags: programmer PHP interview 2009-02-06 15:191. Use PHP to print out the day before, the print format is May 10, 2007 22:21:212. PHP code is as follows:$a = "Hello";$b = $a;Unset ($b);$b = "World";echo $a;What is
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.