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

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



On Wed, Jul 28, 1999 at 03:02:48PM -0400, John Porter wrote:
> Kevin Reid wrote:
> > Something to try shortening:
> > 
> > @ARGV='iMax:Documents:Info:lwall-quotes.txt';$/='%%
> > ';@l=<>;$_=$l[rand@l];chomp;print
> 
> Two characters:
> 
> @ARGV='iMax:Documents:Info:lwall-quotes.txt';$/='%%
> ';@l=<>;print$l[rand@l]=~/(.*)/
> 

Remember that the input record separator has been set to "%%\n".  Replacing
chomp() with /(.*)/ changes the semantics of the code.


Ronald

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