Skip to content

Commit

Permalink
Clarified $\ example (Jim Davis, GH #240).
Browse files Browse the repository at this point in the history
  • Loading branch information
chromatic committed May 25, 2015
1 parent 04c3a02 commit bdc1577
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sections/files.pod
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,21 @@ X<C<$\>>
X<global variables; C<$\>>

Both C<print> and C<say> take a list of operands. Perl uses the magic global
C<$,> as the separator between list values. Perl also uses any value of C<$\>
as the final argument to C<print> or C<say>. Thus these two lines of code
produce the same result:
C<$,> as the separator between list values. Perl uses any value of C<$\> as the
final argument to C<print>N<... but always uses C<\n> as an implicit final
argument to C<say>.>. Remember that C<$\> is C<undef> by default. Thus these
two print examples produce the same result:

=begin programlisting

my @princes = qw( Corwin Eric Random ... );
local $\ = "\n\n";

# prints a list of princes, followed by two newlines
print @princes;
print join( $,, @princes ) . $\;

local $\ = '';
print join( $,, @princes ) . "\n\n";

=end programlisting

Expand Down

0 comments on commit bdc1577

Please sign in to comment.