Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: foreach loops

by mrbbking (Hermit)
on Dec 16, 2001 at 01:08 UTC ( [id://132258]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://132258]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-26 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found