http://qs1969.pair.com?node_id=132258


in reply to foreach loops

In the last example, where foreach uses the default $_, you could go one step further and allow print to do the same.
If you're willing to forego the commas, that is:
foreach(@numbers){ print; }

Replies are listed 'Best First'.
Re (tilly) 2: foreach loops
by tilly (Archbishop) on Dec 16, 2001 at 05:00 UTC
    You can keep the commas and forgo the loop if you want...
    local $, = ","; print @numbers;
Re: Re: foreach loops
by blakem (Monsignor) on Dec 16, 2001 at 01:17 UTC
    Or keep the comma with:
    foreach(@numbers) { local $\ = ','; print; }

    -Blake

      Really i am enjoying doing perl ,as perlmonks are with me. Thanks! for this work.