In general, you need to learn more about Perl strings and interpolation.

You put $contig inside of single tick quotes, and that won't interpolate.

Meanwhile, you wrote ">".$maid_dir."\\".$maid."_aln.out" where you didn't interpolate where a Perl programmer normally would, even though you were using double-tick quotes! For comparison, ">$maid_dir\\${maid}_aln.out" (notice how the last one was handled since it was immediately followed by a character allowed in an identifier).

Meanwhile, use the 3-argument form of open. Don't concatenate the ">" with the name, but keep it as a separate argument. But, as another poster mentioned, passing the open file, stringified (whatever that does) to the blastall.exe command line doesn't make sense. You meant to pass the file name.

my $outfile= "$maid_dir\\${maid}_aln.out"; my $command= qq(c:\\blast\\bin\\blastall -p blastn -d "$hu_seq $hd_seq +" -i $contig +-o $alignment);
Note the use of qq(...) instead of double-tick quotes, so I could use " characters inside the string without escaping them. That's probably why you used single-quotes there in the first place.

I do like how you composed the command string separately to using it in the system command, so you could easily see what the command was.

I don't know why you are putting quotes around the two file names together with a space in between, instead of quoting each file name individually. Something about that blastall.exe I suppose, if that's correct. But beware of $maid_dir containing spaces.

—John


In reply to Re: quoting issue with system command by John M. Dlugosz
in thread quoting issue with system command by lomSpace

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.