Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.