sorry I can't include more of my program here. Here is part of the sub routine where there error occurs. I have been running the program for a while, but always only one file handle open for writing at a time.
print STDERR "saving block $writeCounter, \@ docID $docID "; system("date"); my $postingList = ''; my $posting = ''; my $output = ''; my $savename = "/indexes/1_indexBlock_$writeCounter"; print STDERR "saving $savename\n"; open my $save, ">.$savename" or die "can't open save $!\n"; flock($save, 2) or die "can't lock save $!\n"; print STDERR "$savename is open\n"; foreach my $x (sort (keys %inMemIndex)) { $postingList = $inMemIndex{$x}; $posting = "$x $inMemIndex{$x}\n"; $output .= $posting; } print $save $output or die "can't write to save $!\n"; $output = ''; %inMemIndex = (); flock($save, 8); close $save or die "can't close save $!\n"; system("./logMergeManager.pl $writeCounter &"); $writeCounter++; $totalWordSize = 0;
when $writeCounter gets to 1342, the program dies on writing with the error: "can't write to save Inappropriate ioctl for device" i'm sorry i can't really give a condensed version of the code since this is part of a very large program. i added the flocks just to ensure that nothing is trying to open the file at the same time, its possible that i'm not using these correctly, though i was having this error before i included these. can anyone see any obvious flaws?

EDIT: changed '||' to 'or' as per Fletch's suggestion. re-running my code now.

EDIT: changed file handles as per ikegami's suggestion. seems to be working properly now :)

In reply to Inappropriate ioctl for device by downer

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.