On 28/07/2011 22:36, Emeka wrote:
Hello All,
Could someone explain what $\ (end-of-marker) is?
I need something detail with simple and complex examples?
Take a look at
perldoc perlvar
for documentation on Perl's internal variables like this. This is what
it says
$\ The output record separator for the print operator. If defined,
this value is printed after the last of print's arguments.
Default is "undef". (Mnemonic: you set $\ instead of adding "\n"
at the end of the print. Also, it's just like $/, but it's what
you get "back" from Perl.)
So every call to print will output the value of $\, if any, after the
rest of its arguments. By default it is set to undef, so that print will
output only the parameters it is given.
It is occasionally used to automatically append a special end-of-line
sequence for specialized applications, but if you are using an
up-to-date copy of Perl (5.10 or later) and all you want is to print a
newline after each line, then you are better of writing
use feature 'say';
at the start of your program, and thereafter using 'say' instead of
'print'.
HTH,
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/