Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: When is an code^$/code not a code^$/code?

by Clownburner (Monk)
on Apr 05, 2001 at 06:10 UTC ( [id://69987]=note: print w/replies, xml ) Need Help??


in reply to Re: When is an code^$/code not a code^$/code?
in thread When is an ^$ not a ^$ ?

Another great suggestion!

I tried both of those, but neither worked at all. Same results as before - everything got pushed into $data[0]. :-(

I also tried dws' suggestion, with no results.

I don't know what's wrong with this evil, twisted text file, but I can tell you it's got me up to HERE right now.

And yet, 5 seconds in vi fixes it perfectly. I'm baffled.

A hex editor sees this where the newlines would be:
0d 0a 0d 0a

Any clues?


Signature void where prohibited by law.

Replies are listed 'Best First'.
Re: Re: Re: When is an code^$/code not a code^$/code?
by jeroenes (Priest) on Apr 05, 2001 at 13:21 UTC
    I'm pretty baffled that all these things don't work. Can you put your problem files online maybe?

    0d is hex for \r, 0a is hex for \n. I made myself a testfile by: perl -e 'print "aa\r\nab\r\n\r\naa\nbb\n"' >test Than I tried to get items out from it by: perl -e '$/="\r\n\r\n"; print "\tMy item: $_" while (<>);' <test This gave me the following output:

    My item: aa ab My item: aa bb
    So that seems to work. I don't see why this would work and the others not, so I tried another one:  perl -e 'undef $/;@a=split(/\r\n\r\n/,<>); print join "\t My item: ", @a;' <test Which gave a similar result. There must be something special to your case.

    Hope this helps a bit,

    Jeroen
    "We are not alone"(FZ)

      I'll try to recreate a file that has this problem that I can post; right now the files I'm working on are part of a security audit so the data can't really be posted.

      It is really weird though - the Hex editor confirms that there's nothing there but a bunch of \r\n's, and yet I can't split on \r\n. Funkadelic.

      BTW, this is under Perl 5.005_03, you don't suppose there might be a bug or something?


      Signature void where prohibited by law.
        I just tested the same code at home, on Macperl patchlevel 5.004. Works like a charm.

        Definitely something strange.

        Jeroen
        "We are not alone"(FZ)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://69987]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-03-29 08:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found