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: Perl Programming Help: Intermediate: Re: [mrhedin] Serial data linebreaks in string causing problems: Edit Log



FishMonger
Veteran / Moderator

Dec 17, 2009, 10:01 AM


Views: 1452
Re: [mrhedin] Serial data linebreaks in string causing problems

I'd probably write that as:

Code
open my $OUTFILE, '>>', "$bcppath/test/current.dat" 
or die "Hedin error: [$!]";

my $data;
while ( <SERIAL> ) {
chomp;
$data .= $_;
if ( ($. % 4) == 0 ) {
print $OUTFILE "$data\n";
$data = '';
}
}



(This post was edited by FishMonger on Dec 17, 2009, 10:02 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Dec 17, 2009, 10:02 AM


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

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