coldy has asked for the wisdom of the Perl Monks concerning the following question:
The new file is correct that a new line begins for every '#' but how can I make it skip the newline characters so these lines are concatonated till the next '#'? (I hope that makes sense) (ASIDE: Is there a way to specify different line delimiters for different files using this notation when reading each file reading line by line simultaneously);open(OUT,">$outfile"); open(F1, "<$infile") or die "Could not open $infile for reading!\n"; $/ = "#"; while (<F1>) { print OUT "$_\n"; }
while ($line1 =<F1> || $line2= <F2>){ foo($line1,$line2); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: skip newline charater when reading
by moritz (Cardinal) on Jan 13, 2009 at 10:46 UTC | |
by coldy (Scribe) on Jan 13, 2009 at 10:49 UTC | |
by repellent (Priest) on Jan 13, 2009 at 17:51 UTC | |
|
Re: skip newline charater when reading
by JavaFan (Canon) on Jan 13, 2009 at 11:09 UTC | |
|
Re: skip newline charater when reading
by gone2015 (Deacon) on Jan 13, 2009 at 11:56 UTC | |
|
Re: skip newline charater when reading
by svenXY (Deacon) on Jan 13, 2009 at 10:41 UTC | |
by moritz (Cardinal) on Jan 13, 2009 at 10:47 UTC | |
by davido (Cardinal) on Jan 13, 2009 at 17:04 UTC | |
by repellent (Priest) on Jan 13, 2009 at 17:37 UTC | |
by coldy (Scribe) on Jan 13, 2009 at 10:46 UTC |