perl:使用system函数


system函数使用介绍

#!/usr/bin/perl -w
$stant=system("ls");
print "$stant\n";

$well=system "'date'";
print "three:$well\n-------------\n";

@hello=("echo","hello,world!");
system(@hello);

 

`` 也可以用的
一个简单的例子:

#!/usr/bin/perl -w
@a=`ls /root` ;
foreach ( @a ) {
print $_ ;
}

 

直接输出

print `ls /root`;

5条回应:“perl:使用system函数”

  1. You actually make it seem really easy together with
    your presentation but I in finding this matter to be actually one
    thing which I believe I’d never understand. It kind of feels too complex and extremely broad for me. I am taking a look forward in your next submit, I’ll try to get
    the cling of it!

  2. Thanks for the marvelous posting! I certainly enjoyed reading it, you will be a great author.

    I will make certain to bookmark your blog and definitely will come back down the road.

    I want to encourage you to ultimately continue your great job, have a
    nice afternoon!

  3. I take pleasure in, result in I discovered exactly what I was looking
    for. You have ended my 4 day long hunt! God Bless you man.
    Have a great day. Bye