Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: weird perl verion and/or OS problem with newlines

by asarih (Hermit)
on Sep 24, 2003 at 20:51 UTC ( [id://294012] : note . print w/replies, xml ) Need Help??


in reply to weird perl verion and/or OS problem with newlines

How big are these attachments? It looks like you're putting the entire content of <STDIN> to $str, and this might be causing the seg faults. I think the following (untested) code does what the code does, without consuming too much memory. Comments welcome.
while (<>) { my $val=''; if (/^\#:lav/) { $_.=<>; $val.="$_\n"; while (/^#:eof/m) { $val.="$_\n"; $_.=<>; } } print $val; }
Update: fixed the bonehead error of using next inside the loops.