az noted sAN duz not wrk & ***SHOUTING*** duz not hlp U 2 git Ansz. az we hav d luxury of full [abc]z 2 typ w & usrz 4 huM eng iz not thR 1st lngwij UzN SMS shrt& iz gnrle :-(D upon transl8it here.

Look below when you post and you will see some Writeup Formatting Tips. In Tutorials there are lots of how to ask questions the smart way hints.

Anyway you are obviously on windows and seem to want to apply to power of Perl to automating some stuff for you. Perl can do everything a .bat batch file can and lots more.

To get windows to run a perl script you just make a text file that contains perl code and save it with a .pl extension. If you type script.pl at the command line windows looks at the .pl extension and knows you want perl to execute the script using the perl executable. You can also type C:\>perl script which explicitly tells windows to execute the file <scipt> using perl and lets you call the script anything you want, using any extension you feel like. As a rule .pl makes sense so use it.

In unix the shebang line tells the shell where to find perl. In your application the only significant thing on the usual first line of a perl script (called the shebang line) is the -w flag which switches on warnings. Any script you write should probably start like this:

#!/usr/bin/perl -w use strict

This switches on warning and strict which makes you write code where perl catches lots of errors for you.

To execute an external binary perl gives you three options. backtics, system and exec. You can RTFM to find out the finer details.

#!/usr/bin/perl -w use strict; my $prog = "C:\\path\to\\RNAfold"; my $infile = "C:\\path\\to\\infile"; my $outfile= "C:\\path\\to\\outfile"; my @args = qw/ -p noOUTPUTFILE /; print "Executing with one arg system\n"; my $return_value = system("$prog $infile $outfile"); if ($return_value == 0) { print "Success!\n"; } else { printf "Failed with error code %d\nError message: $?\n", $return_value>>8; } print "Executing with muti arg system\n"; $return_value = system($prog, $infile, $outfile); # or $return_value = system($prog, @args); # check how it went by checking return_value as above print "Executing $prog $infile $outfile with backtics\n"; my $screenoutput = `$prog $infile $outfile`; print "Got $screenoutput\n"; # check how it went by checking $? die "Got error $?\n" if $?

In reply to Re: running a executable program using perl ??? by tachyon-II
in thread running a executable program using perl ??? by thinkdifferent

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.