in reply to Re: issue with LF & CRLF
in thread issue with LF & CRLF

raw dump of the file..first line is okay.Second line has the issue
"Networking Hardware \",\"MDUSR226 \",\"10 Gigabit LR Networking TA +P \",\"USR4516 \",\"USRobotics + \",363.33,454.17,0\r\n\"Networking Hardware \",\"MDUSR227 \",\ +"Tap Rackmount for 3 units\n \",\"USR4500-RMK \" +,\"USRobotics \",43.33,54.17,0\r\n\
There is \n within the quotes.I thought setting binary to 1 should take care of this..I have tried the other solutions but none of them seem to work..

Replies are listed 'Best First'.
Re^3: issue with LF & CRLF
by Loops (Curate) on Aug 07, 2013 at 11:19 UTC

    Okay, the data looks just as you described it. I placed it into a file named "failing.csv" and ran:

    use Parse::CSV; use Data::Dump 'pp'; my $fh = new IO::File('failing.csv', 'r'); my $fail = do { local $/; <$fh> }; pp $fail; # Print input $fh->seek(0,0); $/ = "\r\n"; my $parser = Parse::CSV->new( handle => $fh, csv_attr => { binary => 1 }, ); pp $_ while $_ = $parser->fetch; # Print output
    Which produced...
    "\"Networking Hardware \",\"MDUSR226 \",\"10 Gigabit LR Networking +TAP \",\"USR4516 \",\"USRobotics + \",363.33,454.17,0\r\n\"Networking Hardware \",\"MDUSR227 \" +,\"Tap Rackmount for 3 units\n \",\"USR4500-RMK +\",\"USRobotics \",43.33,54.17,0\r\n" [ "Networking Hardware ", "MDUSR226 ", "10 Gigabit LR Networking TAP ", "USR4516 ", "USRobotics ", 363.33, 454.17, 0, ] [ "Networking Hardware ", "MDUSR227 ", "Tap Rackmount for 3 units\n ", "USR4500-RMK ", "USRobotics ", 43.33, 54.17, 0, ]

    If this doesn't work for you there is some local configuration issue. Odd.

      after hours of head scratching.. i managed to find the issue..I was able to parse the feed using the script provided by loops.I added $/ = "\r\n"; to my script.but it still wont work..i also had quote_space turned on.. switching it off did the trick.Not sure why it was on in the first place. thanks to all the posters for there help