Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Parsing lines containing extra carriage returns

by jeroenes (Priest)
on Jun 13, 2001 at 09:34 UTC ( #88012=note: print w/replies, xml ) Need Help??


in reply to Parsing lines containing extra carriage returns

If bikeNomad's solution doesn't work, just split the whole thing on tabs (untested):
my $file; { local $/ = undef; # learned something ;} $file = <>; #or <FILE> } $file =~ tr/\r//d; #remove carriages my @items = split /[\t\n]/, $file; #one array of items; my $rowsize = 3; my @AoA; while( @items >= $rowsize ){ push @AoA, [splice @items, 0, $rowsize]; }
.... this works only if you're garanteed to have 3 columns.

Hope this helps,

Jeroen
"We are not alone"(FZ)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://88012]
help
Chatterbox?
[Discipulus]: the new spam: gdpr consensus mail
[Corion]: Yeah, but the hope is that when I just delete it I won't receive any more mail from them
[Corion]: ... a faint hope, I know
[Discipulus]: ah ah you are still so optimist, Corion ? ;=)
[Discipulus]: here we are a bit late: i'll inject a ransomware to crypt everything and be compliant

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2018-05-25 07:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?