The best solution is to use the already mentioned chdir Perl built-in to get into the right default directory. But if you want to do it in shell, you could issue two shell commands within the same exec or system shell command string, for example;
my $home='~/bin/MIReNA-2.0'; system("cd $home; ./MIReNA.sh");
An example Perl one-liner on my system:
$ perl -e ' exec "cd ./Matt; ls -l"' total 11756 drwxr-xr-x+ 1 Laurent None 0 27 juin 19:26 appartement -rwxr-xr-x 1 Laurent None 12038144 27 juin 22:27 appartement.tar
In the latest example above, I used exec because I did not care that the program would die immediately after having displayed the content of the directory. I would use system if I wanted the Perl program to do other things after having run the shell command. And if I wanted to retrieve the data in Perl (which is probably the most common use of shelling out calls to the OS), say to format the output of the ls command with line numbers, then I would use backticks instead of exec or system:
$ perl -E ' my @content = `cd ./Matt; ls -l`; print ++$i, ": $_" for +@content' 1: total 11756 2: drwxr-xr-x+ 1 Laurent None 0 27 juin 19:26 appartement 3: -rwxr-xr-x 1 Laurent None 12038144 27 juin 22:27 appartement.tar

In reply to Re: could not get exec and sytem to work by Laurent_R
in thread could not get exec and sytem to work by mnam

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.