[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] $_=$l[rand@l]; (fwd)



RJK writes:
> On Thu, Jul 29, 1999 at 12:14:59PM -0400, John Porter wrote:
> > > @ARGV='iMax:Documents:Info:lwall-quotes.txt';$/='%%
> > > ';@l=<>;print$l[rand@l]=~/(.*)/
> > 
> > To which Ronald J Kimball responded by saying that the
> > semantics of /(.*)/ is different because $/ has been
> > changed.
> 
> Actually, I meant the semantics of the whole block of code, not of the
> regular expression.  Sorry about the confusion.
> 
> > I was not able to confirm that assertion; my tests
> > showed /(.*)/ still considers . (dot) to exclude \n
> > specifically, not $/.  Can anyone shed some light on
> > this?  Is it a perl version difference?
> 
> That's my point.  Unlike the original, your code only accounts for
> newlines, and it only prints the first line of the selected block, without
> a trailing newline.

Oh, yes, you're right.  I was indeed confused.  :-)

John Porter


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe