I'm having a problem running the code at the bottom. It tells me there is no such inputfile even though its sitting in the same directory as the pl script. The error is at the system ("sort -k 1,1 -k 4n -T $workingDir $name line. When I include the print statments
print "argument = /$workingDir/ \n"; print "argument = /$inputFileVolume/ \n"; print "argument = /$inputFileDir/ \n"; print "argument = /'pwd'/ \n"; #it gives me argument = /// argument = // argument = // argument = /'pwd'/
So I guess its not finding the proper directory for some reason. How would I fix this? Thanks
#!/usr/bin/perl use strict; use warnings; use File::Spec; my $inputFile = $ARGV[0]; my $backgroudFile = $ARGV[1]; #get name of the tester file and set it as the current working directo +ry my ($inputFileVolume,$inputFileDir,$name) = File::Spec->splitpath($inp +utFile); my @workingDirArr = ($inputFileVolume,$inputFileDir); my $workingDir = File::Spec->catdir(@workingDirArr); chdir $workingDir or die "$0 failed to chdir to working dir $workingDi +r"; system ("sort -k 1,1 -k 4n -T $workingDir $name >tempLoc_$name")==0 or + die "$0 failed to sort $name"; open (NAM, "tempLoc_$name") or die "$0 failed to open file tempLoc_$na +me";

In reply to problems with perl input by jarwulf

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.