On Fri, Apr 21, 2006 at 04:03:49PM -0700, John W. Krahn wrote:
> Chad Perrin wrote:
> > On Fri, Apr 21, 2006 at 12:48:51PM -0700, John W. Krahn wrote:
> >>print/.*/g,$"while<>
> > 
> > Woah, that's pretty short.
> 
> You can make it even shorter:
> 
> print/.*/g,$"for<>

True, that.  I'm used to using while for that sort of thing, and didn't
even think of for.


> 
> print() provides list context for its arguments and /.*/g in list context
> returns the contents of its pattern match (everything except newline) and then
> print the contents of the $" variable which defaults to a single space 
> character.

Thanks.  I'd completely forgotten about the ability to feed a filehandle
and list to print() as arguments.

I seem to be forgetting a lot.  I must be getting older.

-- 
Chad Perrin [ CCD CopyWrite | http://ccd.apotheon.org ]
Ben Franklin: "As we enjoy great Advantages from the Inventions of
others we should be glad of an Opportunity to serve others by any
Invention of ours, and this we should do freely and generously."

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to