Dear Monks
I'm playing with S Cozen's Finance::QIF module and it contains the code
sub parse_file { my ($class, $file) = @_; local $/; open my $f, $file or croak $!; my $data = <$f>; return $class->parse($data); } =head2 parse Creates a C<Finance::QIF> object from a string. =cut sub parse { my ($class, $data) = @_; my @lines = split /\n/, $data; my $type = shift @lines; croak "Can only handle bank accounts right now, not type $type" unless $type eq "!Type:Bank";
...
I try to parse a QIF file but croak:
$ perl -MCarp=verbose qifread.pl at /usr/local/lib/perl5/site_perl/5.8.4/Finance/QIF.pm line 124 Finance::QIF::parse('Finance::QIF', '!Type:Bank\x{d}\x{a}D09/0 +7/2004\x{d}\x{a}PDTE ENERGY PAYMENT\x{d}\x{a}MDTE ENERGY PAY...') cal +led at /usr/local/lib/perl5/site_perl/5.8.4/Finance/QIF.pm line 111 Finance::QIF::parse_file('Finance::QIF', 'dfcu0904.qif') calle +d at qifread.pl line 6
My question is why didn't the file split on "\x{a}"? Isn't it the same as "/n"?

Thanks (as always).

20040909 Edit by ysth: change pre to code tags Sorry for the "chatty" question. Yes, I understand the sub would still choke on the carriage return character even if "\x{a}" were to be treated as "\n". I just thought maybe someone might explain when "\n" and "\x{a}" are the same in Perl and when they're different. Or maybe point out where in the docs to read--my searches haven't turned anything up.


In reply to end of the line by RandomWalk

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.