On Wed, Jan 6, 2010 at 11:27 AM, Grove, Michael <migr...@state.pa.us> wrote:

> Can someone tell me why I need double quotes for this to work at the line
> with: print $first, $second, $third\n;
>
> #!/usr/bin/perl -w
>
> $first = 0xFF;
> $second = 0377;
> $third = 0b11111111;
> print $first, $second, $third\n;
>

This passes a list to the "print" command. It's equivalent to saying...
my @list = ($first, $second, $third);
print @list;

$answer = $first + $second + $third;
> print "$answer\n";
>
> It only gives this output when I write double quotes "print $first,
> $second, $third\n";
>
> 255, 255, 255
> 765
>

print "$first, $second, $third\n" prints a single, scalar value.

-- 
Robert Wohlfarth

Reply via email to