Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Remove newlines and join lines

by moxliukas (Curate)
on Aug 28, 2002 at 14:14 UTC ( #193464=note: print w/ replies, xml ) Need Help??


in reply to Remove newlines and join lines

Here is a way that I used to solve your problem (be careful about the number of newlines and alike. It is a very fragile approach)

#!/usr/bin/perl -w use strict; my $a = join '', <DATA>; $a =~ s/\n{2}(\d.\d+)/ $1/g; $a =~ s/\n{2}/\n/g; print $a; __DATA__ Alan 2.13 Mary 2.16

This prints:

Alan 2.13 Mary 2.16

I hope this is of any use.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (13)
As of 2016-06-28 13:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (359 votes). Check out past polls.