Phoenix.pm: Perl 101

Kevin Buettner kev at primenet.com
Fri Jul 7 13:01:56 CDT 2000


On Jul 7, 10:48am, Doug Miles wrote:

> #!/usr/bin/perl
> 
> @author = ('Tom', 'Randal', 'Larry');
> print "@author\n";
> print @author;
> print "\n";
> 
> displays this:
> 
> Tom Randal Larry
> TomRandalLarry
> 
> This surprised me that 'print "@author\n";' interpolates with spaces in
> between elements.  Does anyone know where this is documented?

Page 43 of the Camel book.

See also the discussion of $" in the perlvar manpage.  The perlop
manpage also describes it:

                 Interpolated scalars and arrays are internally
                 converted to the join and . Perl operations,
                 thus "$foo >> '@arr'"> becomes:

                   $foo . " >>> '" . (join $", @arr) . "'";


(Note the typo however.)

Kevin



More information about the Phoenix-pm mailing list