-----Original Message-----
From: John W. Krahn [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 21, 2006 7:04 PM
To: Perl Beginners
Subject: Re: golf

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<>

> Thanks.  Now I just need to go read a bit
> and figure out how exactly it works.
> 
> . . . unless you want to explain it.

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.


John
-- 
use Perl;
program
fulfillment

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

What is perl golf?



Cardinal Health -- Working together. For life. (sm)
_________________________________________________

This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise private information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the email by you is prohibited.

Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk 
- Portuguese - Svenska: www.cardinalhealth.com/legal/email

--
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