Hi almut,
I'm sorry, this excursion was very interisting, but that *may* work from the unix side, but on my both XP systems (v5.8.8 and v5.10.0 with komodo) it doesn't work; the yield is only *one* array element.
BUT I have to apologize! The solution is written in the 'ActivePerl User Guide -- Tie::File', witch I did read some times before.
There is another parameter called 'recsep' that worked very well for me. So here is the code.

use Tie::File; # Record separator per default = $/ use Fcntl 'O_RDONLY'; # open in read-only mode my ($sep1, $sep2) = ($ENV{'windir'}) # determine OS ? ("\r\n", "\n") : ("\n", "\r\n"); my $file = shift @ARGV; tie my @array, 'Tie::File', $file, mode => O_RDONLY, memory => 0, recsep => $sep1 or die $!; my $n_recs = @array; # how many records are in the file? unless ($n_recs > 1) { untie @array; tie @array, 'Tie::File', $file, mode => O_RDONLY, memory => 0, recsep => $sep2 or die $!; $n_recs = @array; print join ("~SEP~", @array); die "Found only one array element\n" unless $n_recs > 1; }

Voila! Proggy dies not (in XP).
Nevertheless thanx for your help, almut.
... And I'm still wondering, why neither changing of $/ nor the setting of "<:unix" had any effect at all.


In reply to Re^4: Problems with changing $/ and Tie::File in RO mode (:crlf) by Ooops
in thread Problems with changing $/ and Tie::File in RO mode by Ooops

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.