2008/2/20, John W. Krahn <[EMAIL PROTECTED]>: > > Gunnar Hjalmarsson wrote: > > obdulio santana wrote: > >> Please let me know if everything is Ok. > >> > >> @l = <DATA>; > >> @nl = map /^\s*\n/?1:0,@l; > >> map { print $l[$_] if ("$nl[$_ - 1]$nl[$_]$nl[$_ + 1]" eq "101" ) } (0 > .. > >> $#nl); > > > > 1. It's no longer a tiny version. ;-) > > 2. It generates a warning. Aren't you using strictures and warnings?? > > 3. I'd use a foreach loop instead of map in void context. > > > > foreach ( 1 .. $#nl-1 ) { > > print $l[$_] if ("$nl[$_ - 1]$nl[$_]$nl[$_ + 1]" eq "101" ); > > } > > > Or print the list returned from map: > > print map "$nl[$_-1]$nl[$_]$nl[$_+1]" eq '101' ? $l[$_] : (), 0 .. $#nl; > > Hi, ****************************************** use strict; use warnings; $_ = join '',<DATA>; s/^\s*\n(^.+\n)(?=^\s*\n)/print $1/egm;
__END__ maybe you prefer this tiny version with strict and warnings, yesterday's version was a rush variant, .. sorry but this one is not so bad or, is it?:-) blah blah weather, sports blah ... just small talk Thanks you all live free or die *************************************************