execute - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

execute

generalengeneralen Posts: 68Member
Hi there! Iam on my task with my shell...

At this time I have written exactly this code :

#!/usr/bin/perl -w

print $ENV{'HOMEPATH'};
print ">";
chomp($newdir = );
chdir($newdir) ||
die "cannot chdir to $newdir: $!";
opendir(DOT, ".") ||
die "cannot open dir . $!";
foreach (sort readdir(DOT)) {
print "$_
";
}
closedir (DOT);


the program starts in my home catalog..I also can list the directories in my system. But if I want to execute one of my program how I do then??

Iam a complete noob the programming so easy answers are appreciated =)

/ Thanks

Comments

  • JonathanJonathan Posts: 2,914Member
    : Hi there! Iam on my task with my shell...
    :
    : At this time I have written exactly this code :
    :
    : #!/usr/bin/perl -w
    :
    : print $ENV{'HOMEPATH'};
    : print ">";
    : chomp($newdir = );
    : chdir($newdir) ||
    : die "cannot chdir to $newdir: $!";
    : opendir(DOT, ".") ||
    : die "cannot open dir . $!";
    : foreach (sort readdir(DOT)) {
    : print "$_
    ";
    : }
    : closedir (DOT);
    :
    :
    : the program starts in my home catalog..I also can list the directories
    : in my system. But if I want to execute one of my program how I do
    : then??
    :
    Do you mean execute another program from your script? There are a few ways.

    The easy way if you want to collect the output of the program is to use backticks:-

    $result = `ping 127.0.0.1`;

    Alternatively, you can use system to run the program, which is probably what you'll want to do.

    system('ping 127.0.0.1');

    : Iam a complete noob the programming so easy answers are appreciated =)
    :
    Just yell if I say something you don't understand. I've been doing this for quite a while and it's easy to forget what is and isn't obvious.

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.