Print array variables when using or not using double quotes.

Posted by Nano HE on Stack Overflow See other posts from Stack Overflow or by Nano HE
Published on 2010-04-13T07:05:07Z Indexed on 2010/04/13 7:22 UTC
Read the original article Hit count: 340

Filed under:
|
|
|

Hi, When I learning to print array variables, I found the white space inserted when double quoter used. Snippet code as below. Could you please tell me why?

#!/usr/bin/perl -w
use strict;
use warnings;

my @str_array = ("Perl","array","tutorial");
my @int_array = (5,7,9,10);

print @str_array;
print "\n";
# added the double quotes
print "@str_array";
print "\n";
print @int_array;
print "\n";
# added the double quotes
print "@int_array";

Output:

Perlarraytutorial
Perl array tutorial
57910
5 7 9 10

© Stack Overflow or respective owner

Related posts about array

Related posts about doublequotes