Thread pront - Alternative zu say (11 answers)
Opened by hlubenow at 2012-01-13 19:47

FIFO
 2012-01-14 08:34
#155436 #155436
User since
2005-06-01
469 Artikel
BenutzerIn

user image
noch etwas näher an print(), nämlich mit Ausgabe von $_, wenn ohne Argument aufgerufen:

Code (perl): (dl )
1
2
3
4
5
sub pront {
    local $\ = "\n";
    local $, = "\n";
    print @_ ? @_ : $_;
}


Wenn auch interpolierte arrays aus double-quoted strings (bzw. HERE-Docs) so ausgegeben werden sollen:

Code (perl): (dl )
1
2
3
4
5
6
sub pront {
    local $\ = "\n";
    local $, = "\n";
    local $" = "\n";
    print @_ ? @_ : $_;
}


Editiert von FIFO: typo
Last edited: 2012-01-14 08:44:51 +0100 (CET)
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? -- Brian Kernighan: "The Elements of Programming Style"

View full thread pront - Alternative zu say