一般大家在perl使用Expect.pm。 我想在perl直接调用expect脚本,利用expect完成su root后,在perl中执行root的其他操作,不知是否可行?:roll:
在copy中调用了_ckftp,但是调用的时候只给了两个参数,为什么在_ckftp中可以shift三次呢?是不是调用的时候第一个参数是系统给的什么东西? sub _cktftp { ### ### -- Check tftp arguments my($self) = shift; my($addr) = shift; my($file) = shift; } sub copy { ### ### -- Copy a running-config to a tftp server file my($self) = shift; my($addr) = shift || return undef; my($file) = shift || retur...
use strict; use warnings; foreach my $file ( @ARGV ) { print( "Checking $file: " ); if ( -e $file ) { # does file exist? print( "$file exists!\n" ); if ( -f $file ) { # is the file a plain file? print( "The file $file is:" ); print( " executable" ) if ( -x $file ); # executable? print( " readable" ) if ( -r $file ); # readable? ...
我需要使用perl调用外部程序打开两个.log,然后perl继续下去,代码如下 my $openedfile1="1.log"; my $openedfile2="2.log"; system("\"C:\\Program Files\\IDM Computer Solutions\\UltraEdit\\Uedit32.exe\" $openedfile1\n"); system("\"C:\\Program Files\\IDM Computer Solutions\\UltraEdit\\Uedit32.exe\" $openedfile2\n"); 我如果这样写的话,程序执行到system这里能够调用ue打开log,但是每次只能打开一个,我必须关闭ue...
用perl执行一些ls rm cp等shell命令的时候,例如:rm -f $file,如果$file中含有一些特殊字符,例如$ \之类的,则必须要将$file中的内容替换成\\ \$ 所以想请教有没有什么方法来避免perl调用shell中这种不必要的麻烦 或者直接采用perl内置函数呢? 谢谢