HI,
I am new to perl and I have written a smal script to grab data from
one file, and put them into another file. The problem is new lines,
which are printing nice under a linux environment, but it is all
messed up if I open it with notepad. I am running Perl 5 under cygwin.
Heres the script:


#!/usr/bin/perl

open (READ, "opt.txt") || die "Can't find opt.txt\n";

$x=0;

while ($info = <READ>) {
chomp $info;
@data = split (/\t/, $info);
push @cells, [...@data];
$x++;
}

close READ || die "Couldn't close opt.txt";
open (WRITE, ">rel.txt") || die "Can't find rel.txt\n";

$y=0;

print WRITE "#DoNotEditThisLine: UndoCommandFile off_files model_n_m_z
endfile=/tmp/6222\n\n";

foreach (@cells){
print WRITE "cr balla=1,blablabla=$cells[$y][0],foobar=$cells[$y][0]_
$cells[$y][1]\n";
print WRITE "bleh=10175,foounbar=$cells[$y][1]\n\n";


$y++;
}

close WRITE || die "Couldn't close rel.txt";
exit (0);


Now if I cat the output in cygwin, the newlines are working. If I open
it with notepad, one new line is working which is after print WRITE
"bleh=10175,foounbar=$cells[$y][1]\n\n";  (please note not both of
newlines are working).

Any ideas? I need those in that specific format


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to