CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...: Re: [arnarisetty] Remove new line character: Edit Log



Laurent_R
Veteran / Moderator

Jan 18, 2014, 4:02 PM


Views: 14481
Re: [arnarisetty] Remove new line character

Maybe something along the lines of this untested piece of code:


Code
while (my $line = <$INPUT>) { 
while ($line !~ /^([^|]*\|){10}/) {
$line .= <$INPUT>;
}
# do something with $line
}


or possibly:

Code
while (my $line = <$INPUT>) { 
$line .= <$INPUT> while ($line =~ s/\|/\|/g) < 10;
# do something with $line
}


Again, this is untested, I *think* both ideas should more or less work, but there may be some mistakes.

If it does not work and if you need further help, please provide some input data to make testing possible.


(This post was edited by Laurent_R on Jan 18, 2014, 4:03 PM)


Edit Log:
Post edited by Laurent_R (Veteran) on Jan 18, 2014, 4:03 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives