On Oct 29, 2012, at 4:48 AM, Hermann Norpois wrote:

> Dear list,
> 
> I would like $/ to recognise empty lines (one empty line). I tried
> 
> $/ = "^\s+$";
> 
> But this does not work.
> Error message:
> Unrecognised escape \s passed through at ex2.ol line 5.
> I have an input file structured like this:
> 
> # kljhkjhkljhlkjh
> lk1243, hkjhkjh
> 
> #ztztzti
> jj562356, jkjk7kjk
> 
> My idea was to treat each block as one variable (each block is then = $_  ,
> isnt it?)
> 

See the advice given by 'perldoc -q paragraph' "How can I read in a file by 
paragraphs?"

Setting $/ to "" or "\n\n" works as long as your empty lines contain no blanks.
--
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