Monday, July 25, 2011

print with newline perl



$\="\n";
print "@hell";
print "marvellous";
print "great";
print "asasasasas"."ffffff"."fdifdfd";
print "awesome";

Here the special variable "$\" is used which is added as  the invisible element to end of the print statement .Normally it is empty it can be assigned "\n" if you want to print everytime in a newline.

output:

G:\perl_programs>perl perl_print.pl

marvellous
great
asasasasasfffffffdfdfd
awesome

G:\perl_programs>




No comments:

Post a Comment