Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: println

by Dog and Pony (Priest)
on Jun 07, 2002 at 19:10 UTC ( #172622=note: print w/replies, xml ) Need Help??


in reply to println

I wonder, wouldn't this be more perlish?
#!/usr/bin/perl -w use strict; sub println(@) { print map{"$_\n"} @_; } println 'Foo', 'Bar'; println 'Baz';
Since print accepts an array of things to print, you'd think that the Perl println would provide a shortcut to adding a newline to each element of the array. :)

That said, I've not really missed this shortcut (even though I have a java background), but if it was added, I might just use it.


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

Replies are listed 'Best First'.
Re: Re: println
by tlhf (Scribe) on Jun 07, 2002 at 19:21 UTC
    Well, personally I'm a big fan of print()ing lists, so I'm apprehensive about changing my beloved println. For example, I'm always doing; print($x, $y, $z). Although, now you've stated the idea of printing the list as multiple lines, it's suddenly become very tempting. It's not really println (print-line), but more of a printlns (print-lines)...

    I see this slightly camp module becoming bloated :D

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2021-10-18 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (74 votes). Check out past polls.

    Notices?